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

Unified Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 932773002: Support V8 code caching for imported scripts in ServiceWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use WorkerGlobalScope::createWorkerScriptCachedMetadataHandler Created 5 years, 10 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
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.h ('k') | Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/workers/WorkerGlobalScope.cpp
diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp
index 0617ab47c55862a7e09b0e168949a3791af4442c..a06e0a2cc0612827da1a2b1f0a10dfb4a57604a4 100644
--- a/Source/core/workers/WorkerGlobalScope.cpp
+++ b/Source/core/workers/WorkerGlobalScope.cpp
@@ -32,6 +32,7 @@
#include "bindings/core/v8/ScheduledAction.h"
#include "bindings/core/v8/ScriptSourceCode.h"
#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/V8CacheOptions.h"
#include "core/dom/ActiveDOMObject.h"
#include "core/dom/AddConsoleMessageTask.h"
#include "core/dom/ContextLifecycleNotifier.h"
@@ -84,6 +85,7 @@ public:
WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, const SecurityOrigin* starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients)
: m_url(url)
, m_userAgent(userAgent)
+ , m_v8CacheOptions(V8CacheOptionsDefault)
, m_script(adoptPtr(new WorkerScriptController(*this)))
, m_thread(thread)
, m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorController(this)))
@@ -264,7 +266,9 @@ void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState
InspectorInstrumentation::scriptImported(&executionContext, scriptLoader->identifier(), scriptLoader->script());
RefPtrWillBeRawPtr<ErrorEvent> errorEvent = nullptr;
- m_script->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader->responseURL()), &errorEvent);
+ OwnPtr<Vector<char>> cachedMetaData(scriptLoader->releaseCachedMetadata());
+ OwnPtr<CachedMetadataHandler> handler(createWorkerScriptCachedMetadataHandler(completeURL, cachedMetaData.get()));
+ m_script->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader->responseURL()), &errorEvent, handler.get(), m_v8CacheOptions);
if (errorEvent) {
m_script->rethrowExceptionFromImportedScript(errorEvent.release(), exceptionState);
return;
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.h ('k') | Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698