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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag, | 54 uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag, |
55 const char* name, const char* scope, uint64_t id, | 55 const char* name, const char* scope, uint64_t id, |
56 uint64_t bind_id, int32_t num_args, | 56 uint64_t bind_id, int32_t num_args, |
57 const char** arg_names, const uint8_t* arg_types, | 57 const char** arg_names, const uint8_t* arg_types, |
58 const uint64_t* arg_values, | 58 const uint64_t* arg_values, |
59 unsigned int flags) override; | 59 unsigned int flags) override; |
60 void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, | 60 void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, |
61 const char* name, uint64_t handle) override; | 61 const char* name, uint64_t handle) override; |
62 void SetTracingController(tracing::TracingController* tracing_controller); | 62 void SetTracingController(tracing::TracingController* tracing_controller); |
63 | 63 |
| 64 void AddTraceStateObserver(TraceStateObserver* observer) override; |
| 65 void RemoveTraceStateObserver(TraceStateObserver* observer) override; |
| 66 |
64 private: | 67 private: |
65 static const int kMaxThreadPoolSize; | 68 static const int kMaxThreadPoolSize; |
66 | 69 |
67 Task* PopTaskInMainThreadQueue(v8::Isolate* isolate); | 70 Task* PopTaskInMainThreadQueue(v8::Isolate* isolate); |
68 Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate); | 71 Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate); |
69 | 72 |
70 base::Mutex lock_; | 73 base::Mutex lock_; |
71 bool initialized_; | 74 bool initialized_; |
72 int thread_pool_size_; | 75 int thread_pool_size_; |
73 std::vector<WorkerThread*> thread_pool_; | 76 std::vector<WorkerThread*> thread_pool_; |
74 TaskQueue queue_; | 77 TaskQueue queue_; |
75 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_; | 78 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_; |
76 | 79 |
77 typedef std::pair<double, Task*> DelayedEntry; | 80 typedef std::pair<double, Task*> DelayedEntry; |
78 std::map<v8::Isolate*, | 81 std::map<v8::Isolate*, |
79 std::priority_queue<DelayedEntry, std::vector<DelayedEntry>, | 82 std::priority_queue<DelayedEntry, std::vector<DelayedEntry>, |
80 std::greater<DelayedEntry> > > | 83 std::greater<DelayedEntry> > > |
81 main_thread_delayed_queue_; | 84 main_thread_delayed_queue_; |
82 tracing::TracingController* tracing_controller_; | 85 tracing::TracingController* tracing_controller_; |
83 | 86 |
84 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); | 87 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); |
85 }; | 88 }; |
86 | 89 |
87 | 90 |
88 } // namespace platform | 91 } // namespace platform |
89 } // namespace v8 | 92 } // namespace v8 |
90 | 93 |
91 | 94 |
92 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ | 95 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ |
OLD | NEW |