| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 bool expected_to_run_; | 90 bool expected_to_run_; |
| 91 bool executed_; | 91 bool executed_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(TestTask); | 93 DISALLOW_COPY_AND_ASSIGN(TestTask); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 | 96 |
| 97 class TestWorkerThread : public v8::base::Thread { | 97 class TestWorkerThread : public v8::base::Thread { |
| 98 public: | 98 public: |
| 99 explicit TestWorkerThread(v8::Task* task) | 99 explicit TestWorkerThread(v8::Task* task) |
| 100 : Thread("libplatform TestWorkerThread"), semaphore_(0), task_(task) {} | 100 : Thread(Options("libplatform TestWorkerThread")), |
| 101 semaphore_(0), |
| 102 task_(task) {} |
| 101 virtual ~TestWorkerThread() {} | 103 virtual ~TestWorkerThread() {} |
| 102 | 104 |
| 103 void Signal() { semaphore_.Signal(); } | 105 void Signal() { semaphore_.Signal(); } |
| 104 | 106 |
| 105 // Thread implementation. | 107 // Thread implementation. |
| 106 virtual void Run() V8_OVERRIDE { | 108 virtual void Run() V8_OVERRIDE { |
| 107 semaphore_.Wait(); | 109 semaphore_.Wait(); |
| 108 if (task_) { | 110 if (task_) { |
| 109 task_->Run(); | 111 task_->Run(); |
| 110 delete task_; | 112 delete task_; |
| 111 } | 113 } |
| 112 } | 114 } |
| 113 | 115 |
| 114 private: | 116 private: |
| 115 v8::base::Semaphore semaphore_; | 117 v8::base::Semaphore semaphore_; |
| 116 v8::Task* task_; | 118 v8::Task* task_; |
| 117 | 119 |
| 118 DISALLOW_COPY_AND_ASSIGN(TestWorkerThread); | 120 DISALLOW_COPY_AND_ASSIGN(TestWorkerThread); |
| 119 }; | 121 }; |
| 120 | 122 |
| 121 #endif // TEST_LIBPLATFORM_H_ | 123 #endif // TEST_LIBPLATFORM_H_ |
| OLD | NEW |