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

Side by Side Diff: gin/isolate_holder.cc

Issue 707273005: (WIP) Implement V8 Tracing -- DO NOT LAND (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « gin/gin.gyp ('k') | no next file » | 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 Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium 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 #include "gin/public/isolate_holder.h" 5 #include "gin/public/isolate_holder.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/sys_info.h" 13 #include "base/sys_info.h"
14 #include "gin/array_buffer.h" 14 #include "gin/array_buffer.h"
15 #include "gin/debug_impl.h" 15 #include "gin/debug_impl.h"
16 #include "gin/event_tracer_impl.h"
16 #include "gin/function_template.h" 17 #include "gin/function_template.h"
17 #include "gin/per_isolate_data.h" 18 #include "gin/per_isolate_data.h"
18 #include "gin/public/v8_platform.h" 19 #include "gin/public/v8_platform.h"
19 #include "gin/run_microtasks_observer.h" 20 #include "gin/run_microtasks_observer.h"
20 21
21 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 22 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
22 #include "base/files/memory_mapped_file.h" 23 #include "base/files/memory_mapped_file.h"
23 #include "base/path_service.h" 24 #include "base/path_service.h"
24 #endif // V8_USE_EXTERNAL_STARTUP_DATA 25 #endif // V8_USE_EXTERNAL_STARTUP_DATA
25 26
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 natives.compressed_size = g_mapped_natives->length(); 163 natives.compressed_size = g_mapped_natives->length();
163 v8::V8::SetNativesDataBlob(&natives); 164 v8::V8::SetNativesDataBlob(&natives);
164 165
165 v8::StartupData snapshot; 166 v8::StartupData snapshot;
166 snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data()); 167 snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data());
167 snapshot.raw_size = g_mapped_snapshot->length(); 168 snapshot.raw_size = g_mapped_snapshot->length();
168 snapshot.compressed_size = g_mapped_snapshot->length(); 169 snapshot.compressed_size = g_mapped_snapshot->length();
169 v8::V8::SetSnapshotDataBlob(&snapshot); 170 v8::V8::SetSnapshotDataBlob(&snapshot);
170 #endif // V8_USE_EXTERNAL_STARTUP_DATA 171 #endif // V8_USE_EXTERNAL_STARTUP_DATA
171 v8::V8::Initialize(); 172 v8::V8::Initialize();
173 InitV8EventTracer();
172 v8_is_initialized = true; 174 v8_is_initialized = true;
173 } 175 }
174 176
175 void IsolateHolder::AddRunMicrotasksObserver() { 177 void IsolateHolder::AddRunMicrotasksObserver() {
176 DCHECK(!task_observer_.get()); 178 DCHECK(!task_observer_.get());
177 task_observer_.reset(new RunMicrotasksObserver(isolate_));; 179 task_observer_.reset(new RunMicrotasksObserver(isolate_));;
178 base::MessageLoop::current()->AddTaskObserver(task_observer_.get()); 180 base::MessageLoop::current()->AddTaskObserver(task_observer_.get());
179 } 181 }
180 182
181 void IsolateHolder::RemoveRunMicrotasksObserver() { 183 void IsolateHolder::RemoveRunMicrotasksObserver() {
182 DCHECK(task_observer_.get()); 184 DCHECK(task_observer_.get());
183 base::MessageLoop::current()->RemoveTaskObserver(task_observer_.get()); 185 base::MessageLoop::current()->RemoveTaskObserver(task_observer_.get());
184 task_observer_.reset(); 186 task_observer_.reset();
185 } 187 }
186 188
187 } // namespace gin 189 } // namespace gin
OLDNEW
« no previous file with comments | « gin/gin.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698