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