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

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/V8SnapshotReference.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 25 matching lines...) Expand all
73 75
74 static ModulesInitializer& GetModulesInitializer() { 76 static ModulesInitializer& GetModulesInitializer() {
75 DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer, 77 DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer,
76 (WTF::WrapUnique(new ModulesInitializer))); 78 (WTF::WrapUnique(new ModulesInitializer)));
77 return *initializer; 79 return *initializer;
78 } 80 }
79 81
80 void Initialize(Platform* platform) { 82 void Initialize(Platform* platform) {
81 Platform::Initialize(platform); 83 Platform::Initialize(platform);
82 84
83 V8Initializer::InitializeMainThread(); 85 // Refernce table must be updated before creating isolates.
86 V8SnapshotCreator::SetReferenceTable(
87 V8SnapshotReference::GetReferenceTable());
88 V8Initializer::InitializeMainThread(platform->TakeV8Snapshot());
84 89
85 GetModulesInitializer().Initialize(); 90 GetModulesInitializer().Initialize();
86 91
87 // currentThread is null if we are running on a thread without a message loop. 92 // currentThread is null if we are running on a thread without a message loop.
88 if (WebThread* current_thread = platform->CurrentThread()) { 93 if (WebThread* current_thread = platform->CurrentThread()) {
89 DCHECK(!g_end_of_task_runner); 94 DCHECK(!g_end_of_task_runner);
90 g_end_of_task_runner = new EndOfTaskRunner; 95 g_end_of_task_runner = new EndOfTaskRunner;
91 current_thread->AddTaskObserver(g_end_of_task_runner); 96 current_thread->AddTaskObserver(g_end_of_task_runner);
92 } 97 }
93 } 98 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 void MemoryPressureNotificationToWorkerThreadIsolates( 137 void MemoryPressureNotificationToWorkerThreadIsolates(
133 v8::MemoryPressureLevel level) { 138 v8::MemoryPressureLevel level) {
134 WorkerBackingThread::MemoryPressureNotificationToWorkerThreadIsolates(level); 139 WorkerBackingThread::MemoryPressureNotificationToWorkerThreadIsolates(level);
135 } 140 }
136 141
137 void SetRAILModeOnWorkerThreadIsolates(v8::RAILMode rail_mode) { 142 void SetRAILModeOnWorkerThreadIsolates(v8::RAILMode rail_mode) {
138 WorkerBackingThread::SetRAILModeOnWorkerThreadIsolates(rail_mode); 143 WorkerBackingThread::SetRAILModeOnWorkerThreadIsolates(rail_mode);
139 } 144 }
140 145
141 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698