| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/task_scheduler/task_tracker.h" | 5 #include "base/task_scheduler/task_tracker.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "base/threading/simple_thread.h" | 36 #include "base/threading/simple_thread.h" |
| 37 #include "base/threading/thread_restrictions.h" | 37 #include "base/threading/thread_restrictions.h" |
| 38 #include "base/threading/thread_task_runner_handle.h" | 38 #include "base/threading/thread_task_runner_handle.h" |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 40 | 40 |
| 41 namespace base { | 41 namespace base { |
| 42 namespace internal { | 42 namespace internal { |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 constexpr size_t kLoadTestNumIterations = 100; | 46 constexpr size_t kLoadTestNumIterations = 75; |
| 47 | 47 |
| 48 // Invokes a closure asynchronously. | 48 // Invokes a closure asynchronously. |
| 49 class CallbackThread : public SimpleThread { | 49 class CallbackThread : public SimpleThread { |
| 50 public: | 50 public: |
| 51 explicit CallbackThread(const Closure& closure) | 51 explicit CallbackThread(const Closure& closure) |
| 52 : SimpleThread("CallbackThread"), closure_(closure) {} | 52 : SimpleThread("CallbackThread"), closure_(closure) {} |
| 53 | 53 |
| 54 // Returns true once the callback returns. | 54 // Returns true once the callback returns. |
| 55 bool has_returned() { return has_returned_.IsSet(); } | 55 bool has_returned() { return has_returned_.IsSet(); } |
| 56 | 56 |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 ASSERT_TRUE(tracker.WillPostTask(task.get())); | 943 ASSERT_TRUE(tracker.WillPostTask(task.get())); |
| 944 | 944 |
| 945 HistogramTester tester; | 945 HistogramTester tester; |
| 946 EXPECT_TRUE(tracker.RunTask(std::move(task), SequenceToken::Create())); | 946 EXPECT_TRUE(tracker.RunTask(std::move(task), SequenceToken::Create())); |
| 947 tester.ExpectTotalCount(test.expected_histogram, 1); | 947 tester.ExpectTotalCount(test.expected_histogram, 1); |
| 948 } | 948 } |
| 949 } | 949 } |
| 950 | 950 |
| 951 } // namespace internal | 951 } // namespace internal |
| 952 } // namespace base | 952 } // namespace base |
| OLD | NEW |