Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #include "util/thread/worker_thread.h" | 15 #include "util/thread/worker_thread.h" |
| 16 | 16 |
| 17 #include "gtest/gtest.h" | 17 #include "gtest/gtest.h" |
| 18 #include "util/misc/clock.h" | 18 #include "util/misc/clock.h" |
| 19 #include "util/synchronization/semaphore.h" | 19 #include "util/synchronization/semaphore.h" |
| 20 | 20 |
| 21 namespace crashpad { | 21 namespace crashpad { |
| 22 namespace test { | 22 namespace test { |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 const uint64_t kNanosecondsPerSecond = 1E9; | 25 const uint64_t kNanosecondsPerSecond = static_cast<uint64_t>(1E9); |
|
Robert Sesek
2016/01/04 22:26:23
Also had to add this static_cast on Windows.
| |
| 26 | 26 |
| 27 class WorkDelegate : public WorkerThread::Delegate { | 27 class WorkDelegate : public WorkerThread::Delegate { |
| 28 public: | 28 public: |
| 29 WorkDelegate() {} | 29 WorkDelegate() {} |
| 30 ~WorkDelegate() {} | 30 ~WorkDelegate() {} |
| 31 | 31 |
| 32 void DoWork(const WorkerThread* thread) override { | 32 void DoWork(const WorkerThread* thread) override { |
| 33 if (++work_count_ == waiting_for_count_) | 33 if (++work_count_ == waiting_for_count_) |
| 34 semaphore_.Signal(); | 34 semaphore_.Signal(); |
| 35 } | 35 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 | 128 |
| 129 EXPECT_GE(100 * kNanosecondsPerSecond, ClockMonotonicNanoseconds() - start); | 129 EXPECT_GE(100 * kNanosecondsPerSecond, ClockMonotonicNanoseconds() - start); |
| 130 | 130 |
| 131 thread.Stop(); | 131 thread.Stop(); |
| 132 EXPECT_FALSE(thread.is_running()); | 132 EXPECT_FALSE(thread.is_running()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace | 135 } // namespace |
| 136 } // namespace test | 136 } // namespace test |
| 137 } // namespace crashpad | 137 } // namespace crashpad |
| OLD | NEW |