Lines Matching refs:std
67 explicit TestEnqueueEnd(Queue<std::string>* queue, Handler* handler) in TestEnqueueEnd()
72 void RegisterEnqueue(std::unordered_map<int, std::promise<int>>* promise_map) { in RegisterEnqueue()
78 std::promise<void> promise; in UnregisterEnqueue()
82 …common::BindOnce(&TestEnqueueEnd::handle_unregister_enqueue, common::Unretained(this), std::move(p… in UnregisterEnqueue()
86 std::unique_ptr<std::string> EnqueueCallbackForTest() { in EnqueueCallbackForTest()
88 std::this_thread::sleep_for(std::chrono::milliseconds(delay_)); in EnqueueCallbackForTest()
92 std::unique_ptr<std::string> data = std::move(buffer_.front()); in EnqueueCallbackForTest()
94 std::string copy = *data; in EnqueueCallbackForTest()
111 std::queue<std::unique_ptr<std::string>> buffer_;
116 Queue<std::string>* queue_;
117 std::unordered_map<int, std::promise<int>>* promise_map_;
124 void handle_unregister_enqueue(std::promise<void> promise) { in handle_unregister_enqueue()
132 explicit TestDequeueEnd(Queue<std::string>* queue, Handler* handler, int capacity) in TestDequeueEnd()
137 void RegisterDequeue(std::unordered_map<int, std::promise<int>>* promise_map) { in RegisterDequeue()
143 std::promise<void> promise; in UnregisterDequeue()
147 …common::BindOnce(&TestDequeueEnd::handle_unregister_dequeue, common::Unretained(this), std::move(p… in UnregisterDequeue()
153 std::this_thread::sleep_for(std::chrono::milliseconds(delay_)); in DequeueCallbackForTest()
157 std::unique_ptr<std::string> data = queue_->TryDequeue(); in DequeueCallbackForTest()
158 buffer_.push(std::move(data)); in DequeueCallbackForTest()
175 std::queue<std::unique_ptr<std::string>> buffer_;
180 Queue<std::string>* queue_;
181 std::unordered_map<int, std::promise<int>>* promise_map_;
189 void handle_unregister_dequeue(std::promise<void> promise) { in handle_unregister_dequeue()
204 Queue<std::string> queue(kQueueSize); in TEST_F()
209 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
210 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
215 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
216 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
221 std::this_thread::sleep_for(std::chrono::milliseconds(20)); in TEST_F()
228 Queue<std::string> queue(kQueueSize); in TEST_F()
232 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
234 std::this_thread::sleep_for(std::chrono::milliseconds(20)); in TEST_F()
246 Queue<std::string> queue(kQueueSize); in TEST_F()
251 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
252 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
254 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
255 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
263 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
264 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
269 std::this_thread::sleep_for(std::chrono::milliseconds(20)); in TEST_F()
280 Queue<std::string> queue(kQueueSize); in TEST_F()
286 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
287 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
289 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
290 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
297 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
298 …dequeue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(kQueueSize), std::forw… in TEST_F()
313 Queue<std::string> queue(kQueueSize); in TEST_F()
318 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
319 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
321 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
322 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
330 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
331 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
335 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
346 Queue<std::string> queue(kQueueSize); in TEST_F()
352 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
353 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
355 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
356 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
363 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
365 std::piecewise_construct, std::forward_as_tuple(kHalfOfQueueSize), std::forward_as_tuple()); in TEST_F()
382 Queue<std::string> queue(kQueueSize); in TEST_F()
387 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
388 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
392 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
393 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(kQueueSize), std::forw… in TEST_F()
400 std::this_thread::sleep_for(std::chrono::milliseconds(20)); in TEST_F()
411 Queue<std::string> queue(kQueueSize); in TEST_F()
417 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
418 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
422 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
424 std::piecewise_construct, std::forward_as_tuple(kHalfOfQueueSize), std::forward_as_tuple()); in TEST_F()
429 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
431 std::piecewise_construct, std::forward_as_tuple(kHalfOfQueueSize), std::forward_as_tuple()); in TEST_F()
442 std::this_thread::sleep_for(std::chrono::milliseconds(20)); in TEST_F()
453 Queue<std::string> queue(kQueueSize); in TEST_F()
459 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
460 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
464 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
470 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
471 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
487 Queue<std::string> queue(kQueueSizeOne); in TEST_F()
493 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
494 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
498 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
499 …dequeue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(kQueueSize), std::forw… in TEST_F()
504 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
519 Queue<std::string> queue(kQueueSize); in TEST_F()
525 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
526 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
528 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
529 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(kQueueSize), std::forw… in TEST_F()
530 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
537 std::this_thread::sleep_for(std::chrono::milliseconds(20)); in TEST_F()
541 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
556 Queue<std::string> queue(kQueueSizeOne); in TEST_F()
562 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
563 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
567 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
568 …dequeue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(kQueueSize), std::forw… in TEST_F()
573 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
590 Queue<std::string> queue(kQueueSize); in TEST_F()
596 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
597 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
599 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
600 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
607 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
609 std::piecewise_construct, std::forward_as_tuple(kHalfOfQueueSize), std::forward_as_tuple()); in TEST_F()
616 std::this_thread::sleep_for(std::chrono::milliseconds(20)); in TEST_F()
624 Queue<std::string> queue(kQueueSize); in TEST_F()
630 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
631 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
633 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
634 …enqueue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tu… in TEST_F()
642 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
643 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
648 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
649 …dequeue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(kQueueSize), std::forw… in TEST_F()
656 std::this_thread::sleep_for(std::chrono::milliseconds(20)); in TEST_F()
664 Queue<std::string> queue(kQueueSize); in TEST_F()
669 std::unordered_map<int, std::promise<int>> dequeue_promise_map; in TEST_F()
670 …dequeue_promise_map.emplace(std::piecewise_construct, std::forward_as_tuple(kQueueSize), std::forw… in TEST_F()
675 std::unique_ptr<std::string> data = std::make_unique<std::string>(std::to_string(i)); in TEST_F()
676 test_enqueue_end.buffer_.push(std::move(data)); in TEST_F()
678 std::unordered_map<int, std::promise<int>> enqueue_promise_map; in TEST_F()
688 Queue<std::string>* queue = new Queue<std::string>(kQueueSize); in TEST_F()
691 std::string valid = "Valid String"; in TEST_F()
692 std::shared_ptr<std::string> shared = std::make_shared<std::string>(valid); in TEST_F()
696 [](Queue<std::string>* queue, std::shared_ptr<std::string> shared) { in TEST_F()
698 return std::make_unique<std::string>(*shared); in TEST_F()
707 [](Queue<std::string>* queue, std::string valid) { in TEST_F()
716 std::promise<void> promise; in TEST_F()
720 [](os::Handler* dequeue_handler, Queue<std::string>* queue, std::promise<void>* promise) { in TEST_F()
722 [](Queue<std::string>* queue, std::promise<void>* promise) { in TEST_F()
735 std::unique_ptr<std::string> sleep_and_enqueue_callback(int* to_increase) { in sleep_and_enqueue_callback()
736 std::this_thread::sleep_for(std::chrono::milliseconds(100)); in sleep_and_enqueue_callback()
738 return std::make_unique<std::string>("Hello"); in sleep_and_enqueue_callback()
742 Queue<std::string> queue(10); in TEST_F()
745 std::this_thread::sleep_for(std::chrono::milliseconds(50)); in TEST_F()
751 std::unique_ptr<std::string> sleep_and_enqueue_callback_and_unregister( in sleep_and_enqueue_callback_and_unregister()
752 int* to_increase, Queue<std::string>* queue, std::atomic_bool* is_registered) { in sleep_and_enqueue_callback_and_unregister()
753 std::this_thread::sleep_for(std::chrono::milliseconds(100)); in sleep_and_enqueue_callback_and_unregister()
758 return std::make_unique<std::string>("Hello"); in sleep_and_enqueue_callback_and_unregister()
762 Queue<std::string> queue(10); in TEST_F()
764 std::atomic_bool is_registered = true; in TEST_F()
772 std::this_thread::sleep_for(std::chrono::milliseconds(50)); in TEST_F()
781 std::this_thread::sleep_for(std::chrono::milliseconds(100)); in sleep_and_dequeue_callback()
787 Queue<std::string> queue(10); in TEST_F()
791 [](Queue<std::string>* queue) { in TEST_F()
793 return std::make_unique<std::string>("Hello"); in TEST_F()
797 std::this_thread::sleep_for(std::chrono::milliseconds(50)); in TEST_F()
809 Queue<std::string>* queue = new Queue<std::string>(kQueueSizeOne); in RegisterEnqueueAndDelete()
811 …enqueue_handler, common::Bind([]() { return std::make_unique<std::string>("A string to fill the qu… in RegisterEnqueueAndDelete()
818 Queue<std::string>* queue = new Queue<std::string>(kQueueSizeOne); in RegisterDequeueAndDelete()
821 … common::Bind([](Queue<std::string>* queue) { queue->TryDequeue(); }, common::Unretained(queue))); in RegisterDequeueAndDelete()
847 std::unique_ptr<int> front = callback.Run(); in handle_register_enqueue()
859 std::queue<int> queue_;
876 std::promise<void> promise; in SynchronizeHandler()
878 …handler_->Post(common::BindOnce([](std::promise<void> promise) { promise.set_value(); }, std::move… in SynchronizeHandler()
891 enqueue_buffer_.Enqueue(std::make_unique<int>(i), handler_); in TEST_F()
905 enqueue_buffer_.Enqueue(std::make_unique<int>(i), handler_); in TEST_F()
917 enqueue_buffer->Enqueue(std::make_unique<int>(i), handler_); in TEST_F()