| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project 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 #ifndef V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ | 5 #ifndef V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ |
| 6 #define V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ | 6 #define V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ |
| 7 | 7 |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // v8::Platform implementation. | 36 // v8::Platform implementation. |
| 37 void CallOnBackgroundThread(Task* task, | 37 void CallOnBackgroundThread(Task* task, |
| 38 ExpectedRuntime expected_runtime) override; | 38 ExpectedRuntime expected_runtime) override; |
| 39 void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override; | 39 void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override; |
| 40 void CallDelayedOnForegroundThread(Isolate* isolate, Task* task, | 40 void CallDelayedOnForegroundThread(Isolate* isolate, Task* task, |
| 41 double delay_in_seconds) override; | 41 double delay_in_seconds) override; |
| 42 void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) override; | 42 void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) override; |
| 43 bool IdleTasksEnabled(Isolate* isolate) override; | 43 bool IdleTasksEnabled(Isolate* isolate) override; |
| 44 double MonotonicallyIncreasingTime() override; | 44 double MonotonicallyIncreasingTime() override; |
| 45 const uint8_t* GetCategoryGroupEnabled(const char* name) override; |
| 46 const char* GetCategoryGroupName( |
| 47 const uint8_t* category_enabled_flag) override; |
| 48 uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag, |
| 49 const char* name, uint64_t id, uint64_t bind_id, |
| 50 int32_t num_args, const char** arg_names, |
| 51 const uint8_t* arg_types, const uint64_t* arg_values, |
| 52 unsigned int flags) override; |
| 53 void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, |
| 54 const char* name, uint64_t handle) override; |
| 55 |
| 45 | 56 |
| 46 private: | 57 private: |
| 47 static const int kMaxThreadPoolSize; | 58 static const int kMaxThreadPoolSize; |
| 48 | 59 |
| 49 Task* PopTaskInMainThreadQueue(v8::Isolate* isolate); | 60 Task* PopTaskInMainThreadQueue(v8::Isolate* isolate); |
| 50 Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate); | 61 Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate); |
| 51 | 62 |
| 52 base::Mutex lock_; | 63 base::Mutex lock_; |
| 53 bool initialized_; | 64 bool initialized_; |
| 54 int thread_pool_size_; | 65 int thread_pool_size_; |
| 55 std::vector<WorkerThread*> thread_pool_; | 66 std::vector<WorkerThread*> thread_pool_; |
| 56 TaskQueue queue_; | 67 TaskQueue queue_; |
| 57 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_; | 68 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_; |
| 58 | 69 |
| 59 typedef std::pair<double, Task*> DelayedEntry; | 70 typedef std::pair<double, Task*> DelayedEntry; |
| 60 std::map<v8::Isolate*, | 71 std::map<v8::Isolate*, |
| 61 std::priority_queue<DelayedEntry, std::vector<DelayedEntry>, | 72 std::priority_queue<DelayedEntry, std::vector<DelayedEntry>, |
| 62 std::greater<DelayedEntry> > > | 73 std::greater<DelayedEntry> > > |
| 63 main_thread_delayed_queue_; | 74 main_thread_delayed_queue_; |
| 64 | 75 |
| 65 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); | 76 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); |
| 66 }; | 77 }; |
| 67 | 78 |
| 68 | 79 |
| 69 } // namespace platform | 80 } // namespace platform |
| 70 } // namespace v8 | 81 } // namespace v8 |
| 71 | 82 |
| 72 | 83 |
| 73 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ | 84 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ |
| OLD | NEW |