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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag, | 48 uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag, |
49 const char* name, uint64_t id, uint64_t bind_id, | 49 const char* name, uint64_t id, uint64_t bind_id, |
50 int32_t num_args, const char** arg_names, | 50 int32_t num_args, const char** arg_names, |
51 const uint8_t* arg_types, const uint64_t* arg_values, | 51 const uint8_t* arg_types, const uint64_t* arg_values, |
52 unsigned int flags) override; | 52 unsigned int flags) override; |
53 void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, | 53 void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, |
54 const char* name, uint64_t handle) override; | 54 const char* name, uint64_t handle) override; |
55 | 55 |
56 | 56 |
57 private: | 57 private: |
58 static const int kMaxThreadPoolSize; | 58 static const int kDefaultThreadPoolSize; |
59 | 59 |
60 Task* PopTaskInMainThreadQueue(v8::Isolate* isolate); | 60 Task* PopTaskInMainThreadQueue(v8::Isolate* isolate); |
61 Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate); | 61 Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate); |
62 | 62 |
63 base::Mutex lock_; | 63 base::Mutex lock_; |
64 bool initialized_; | 64 bool initialized_; |
| 65 const int max_thread_pool_size_; |
65 int thread_pool_size_; | 66 int thread_pool_size_; |
66 std::vector<WorkerThread*> thread_pool_; | 67 std::vector<WorkerThread*> thread_pool_; |
67 TaskQueue queue_; | 68 TaskQueue queue_; |
68 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_; | 69 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_; |
69 | 70 |
70 typedef std::pair<double, Task*> DelayedEntry; | 71 typedef std::pair<double, Task*> DelayedEntry; |
71 std::map<v8::Isolate*, | 72 std::map<v8::Isolate*, |
72 std::priority_queue<DelayedEntry, std::vector<DelayedEntry>, | 73 std::priority_queue<DelayedEntry, std::vector<DelayedEntry>, |
73 std::greater<DelayedEntry> > > | 74 std::greater<DelayedEntry> > > |
74 main_thread_delayed_queue_; | 75 main_thread_delayed_queue_; |
75 | 76 |
76 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); | 77 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); |
77 }; | 78 }; |
78 | 79 |
79 | 80 |
80 } // namespace platform | 81 } // namespace platform |
81 } // namespace v8 | 82 } // namespace v8 |
82 | 83 |
83 | 84 |
84 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ | 85 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ |
OLD | NEW |