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

Side by Side Diff: third_party/WebKit/Source/web/WebKit.cpp

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Work for most comments Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "public/web/WebKit.h" 31 #include "public/web/WebKit.h"
32 32
33 #include <memory> 33 #include <memory>
34 34
35 #include "bindings/core/v8/V8BindingForCore.h" 35 #include "bindings/core/v8/V8BindingForCore.h"
36 #include "bindings/core/v8/V8GCController.h" 36 #include "bindings/core/v8/V8GCController.h"
37 #include "bindings/core/v8/V8Initializer.h" 37 #include "bindings/core/v8/V8Initializer.h"
38 #include "bindings/core/v8/V8SnapshotCreator.h"
39 #include "bindings/modules/v8/V8SnapshotExternalReferences.h"
38 #include "core/animation/AnimationClock.h" 40 #include "core/animation/AnimationClock.h"
39 #include "core/layout/LayoutTheme.h" 41 #include "core/layout/LayoutTheme.h"
40 #include "core/page/Page.h" 42 #include "core/page/Page.h"
41 #include "core/workers/WorkerBackingThread.h" 43 #include "core/workers/WorkerBackingThread.h"
42 #include "gin/public/v8_platform.h" 44 #include "gin/public/v8_platform.h"
43 #include "modules/ModulesInitializer.h" 45 #include "modules/ModulesInitializer.h"
44 #include "platform/LayoutTestSupport.h" 46 #include "platform/LayoutTestSupport.h"
45 #include "platform/bindings/Microtask.h" 47 #include "platform/bindings/Microtask.h"
46 #include "platform/heap/Heap.h" 48 #include "platform/heap/Heap.h"
47 #include "platform/wtf/Assertions.h" 49 #include "platform/wtf/Assertions.h"
(...skipping 26 matching lines...) Expand all
74 76
75 static ModulesInitializer& GetModulesInitializer() { 77 static ModulesInitializer& GetModulesInitializer() {
76 DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer, 78 DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer,
77 (WTF::WrapUnique(new ModulesInitializer))); 79 (WTF::WrapUnique(new ModulesInitializer)));
78 return *initializer; 80 return *initializer;
79 } 81 }
80 82
81 void Initialize(Platform* platform) { 83 void Initialize(Platform* platform) {
82 Platform::Initialize(platform); 84 Platform::Initialize(platform);
83 85
84 V8Initializer::InitializeMainThread(); 86 // Refernce table must be updated before creating isolates.
87 V8SnapshotCreator::SetReferenceTable(
Yuki 2017/06/01 14:15:51 Can we put this into InitializeMainThread() consid
peria 2017/06/20 10:20:14 No, we can't. V8Initializer is under core/, and V8
88 V8SnapshotExternalReferences::GetTable());
89 V8Initializer::InitializeMainThread(platform->TakeV8Snapshot());
Yuki 2017/06/01 14:15:51 Can we simply pass |platform| and let InitliazeMai
peria 2017/06/20 10:20:14 Done. I found we can call platform via Platform::C
85 90
86 GetModulesInitializer().Initialize(); 91 GetModulesInitializer().Initialize();
87 92
88 WebFactoryImpl::Initialize(); 93 WebFactoryImpl::Initialize();
89 94
90 // currentThread is null if we are running on a thread without a message loop. 95 // currentThread is null if we are running on a thread without a message loop.
91 if (WebThread* current_thread = platform->CurrentThread()) { 96 if (WebThread* current_thread = platform->CurrentThread()) {
92 DCHECK(!g_end_of_task_runner); 97 DCHECK(!g_end_of_task_runner);
93 g_end_of_task_runner = new EndOfTaskRunner; 98 g_end_of_task_runner = new EndOfTaskRunner;
94 current_thread->AddTaskObserver(g_end_of_task_runner); 99 current_thread->AddTaskObserver(g_end_of_task_runner);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void MemoryPressureNotificationToWorkerThreadIsolates( 140 void MemoryPressureNotificationToWorkerThreadIsolates(
136 v8::MemoryPressureLevel level) { 141 v8::MemoryPressureLevel level) {
137 WorkerBackingThread::MemoryPressureNotificationToWorkerThreadIsolates(level); 142 WorkerBackingThread::MemoryPressureNotificationToWorkerThreadIsolates(level);
138 } 143 }
139 144
140 void SetRAILModeOnWorkerThreadIsolates(v8::RAILMode rail_mode) { 145 void SetRAILModeOnWorkerThreadIsolates(v8::RAILMode rail_mode) {
141 WorkerBackingThread::SetRAILModeOnWorkerThreadIsolates(rail_mode); 146 WorkerBackingThread::SetRAILModeOnWorkerThreadIsolates(rail_mode);
142 } 147 }
143 148
144 } // namespace blink 149 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698