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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: . Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
index ca900dc4ff2fe33e30e52f4fec0dd188956cbcd7..7babc3b6760edd948b093cabe19b54f33879ce13 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -45,6 +45,7 @@
#include "bindings/core/v8/V8Location.h"
#include "bindings/core/v8/V8PerContextData.h"
#include "bindings/core/v8/V8PrivateProperty.h"
+#include "bindings/core/v8/V8SnapshotCreator.h"
#include "bindings/core/v8/V8Window.h"
#include "bindings/core/v8/WorkerOrWorkletScriptController.h"
#include "core/dom/Document.h"
@@ -446,7 +447,7 @@ static void AdjustAmountOfExternalAllocatedMemory(int64_t diff) {
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(diff);
}
-void V8Initializer::InitializeMainThread() {
+void V8Initializer::InitializeMainThread(intptr_t* table) {
DCHECK(IsMainThread());
WTF::ArrayBufferContents::Initialize(AdjustAmountOfExternalAllocatedMemory);
@@ -459,14 +460,17 @@ void V8Initializer::InitializeMainThread() {
v8_extras_mode, &array_buffer_allocator);
// NOTE: Some threads (namely utility threads) don't have a scheduler.
- WebScheduler* scheduler = Platform::Current()->CurrentThread()->Scheduler();
+ WebThread* thread = Platform::Current()->CurrentThread();
+ WebScheduler* scheduler = thread ? thread->Scheduler() : nullptr;
+
// When timer task runner is used for PerIsolateData, GC tasks are getting
// throttled and memory usage goes up. For now we're using loading task queue
// to prevent this.
// TODO(altimin): Consider switching to timerTaskRunner here.
v8::Isolate* isolate = V8PerIsolateData::Initialize(
scheduler ? scheduler->LoadingTaskRunner()
- : Platform::Current()->CurrentThread()->GetWebTaskRunner());
+ : thread ? thread->GetWebTaskRunner() : nullptr,
+ table, V8SnapshotCreator::TakingSnapshot());
InitializeV8Common(isolate);

Powered by Google App Engine
This is Rietveld 408576698