Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: src/libplatform/default-platform.h

Issue 2137013006: [Tracing] V8 Tracing Controller (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add Setters for TraceConfig categories Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/d8.cc ('k') | src/libplatform/default-platform.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "include/libplatform/v8-tracing.h"
13 #include "include/v8-platform.h" 14 #include "include/v8-platform.h"
14 #include "src/base/macros.h" 15 #include "src/base/macros.h"
15 #include "src/base/platform/mutex.h" 16 #include "src/base/platform/mutex.h"
16 #include "src/libplatform/task-queue.h" 17 #include "src/libplatform/task-queue.h"
17 18
18 namespace v8 { 19 namespace v8 {
19 namespace platform { 20 namespace platform {
20 21
21 class TaskQueue; 22 class TaskQueue;
22 class Thread; 23 class Thread;
23 class WorkerThread; 24 class WorkerThread;
24 25
26 namespace tracing {
27 class TracingController;
28 }
29
25 class DefaultPlatform : public Platform { 30 class DefaultPlatform : public Platform {
26 public: 31 public:
27 DefaultPlatform(); 32 DefaultPlatform();
28 virtual ~DefaultPlatform(); 33 virtual ~DefaultPlatform();
29 34
30 void SetThreadPoolSize(int thread_pool_size); 35 void SetThreadPoolSize(int thread_pool_size);
31 36
32 void EnsureInitialized(); 37 void EnsureInitialized();
33 38
34 bool PumpMessageLoop(v8::Isolate* isolate); 39 bool PumpMessageLoop(v8::Isolate* isolate);
(...skipping 12 matching lines...) Expand all
47 const char* GetCategoryGroupName( 52 const char* GetCategoryGroupName(
48 const uint8_t* category_enabled_flag) override; 53 const uint8_t* category_enabled_flag) override;
49 uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag, 54 uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag,
50 const char* name, const char* scope, uint64_t id, 55 const char* name, const char* scope, uint64_t id,
51 uint64_t bind_id, int32_t num_args, 56 uint64_t bind_id, int32_t num_args,
52 const char** arg_names, const uint8_t* arg_types, 57 const char** arg_names, const uint8_t* arg_types,
53 const uint64_t* arg_values, 58 const uint64_t* arg_values,
54 unsigned int flags) override; 59 unsigned int flags) override;
55 void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, 60 void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
56 const char* name, uint64_t handle) override; 61 const char* name, uint64_t handle) override;
57 62 void SetTracingController(tracing::TracingController* tracing_controller);
58 63
59 private: 64 private:
60 static const int kMaxThreadPoolSize; 65 static const int kMaxThreadPoolSize;
61 66
62 Task* PopTaskInMainThreadQueue(v8::Isolate* isolate); 67 Task* PopTaskInMainThreadQueue(v8::Isolate* isolate);
63 Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate); 68 Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate);
64 69
65 base::Mutex lock_; 70 base::Mutex lock_;
66 bool initialized_; 71 bool initialized_;
67 int thread_pool_size_; 72 int thread_pool_size_;
68 std::vector<WorkerThread*> thread_pool_; 73 std::vector<WorkerThread*> thread_pool_;
69 TaskQueue queue_; 74 TaskQueue queue_;
70 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_; 75 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_;
71 76
72 typedef std::pair<double, Task*> DelayedEntry; 77 typedef std::pair<double, Task*> DelayedEntry;
73 std::map<v8::Isolate*, 78 std::map<v8::Isolate*,
74 std::priority_queue<DelayedEntry, std::vector<DelayedEntry>, 79 std::priority_queue<DelayedEntry, std::vector<DelayedEntry>,
75 std::greater<DelayedEntry> > > 80 std::greater<DelayedEntry> > >
76 main_thread_delayed_queue_; 81 main_thread_delayed_queue_;
82 tracing::TracingController* tracing_controller_;
77 83
78 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); 84 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform);
79 }; 85 };
80 86
81 87
82 } // namespace platform 88 } // namespace platform
83 } // namespace v8 89 } // namespace v8
84 90
85 91
86 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ 92 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/d8.cc ('k') | src/libplatform/default-platform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698