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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/CompiledScript.cpp

Issue 2695713015: WIP: Reland CompiledScript, prototype compiling in a separate task.
Patch Set: allow fetchFinished to finish when there is no frame Created 3 years, 9 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "bindings/core/v8/CompiledScript.h"
6
7 #include "bindings/core/v8/V8Binding.h"
8
9 namespace blink {
10
11 CompiledScript::CompiledScript(ExecutionContext* context,
12 v8::Local<v8::Script> script,
13 const ScriptSourceCode& sourceCode)
14 : ContextLifecycleObserver(context),
15 m_sourceCode(sourceCode),
16 m_script(toIsolate(context), script) {
17 DCHECK(!script.IsEmpty());
18 }
19
20 CompiledScript::~CompiledScript() = default;
21
22 v8::Local<v8::Script> CompiledScript::getScript(
23 ExecutionContext* executionContext) const {
24 if (executionContext != getExecutionContext())
25 return v8::Local<v8::Script>();
26 return m_script.Get(toIsolate(executionContext));
27 }
28
29 void CompiledScript::contextDestroyed(ExecutionContext*) {
30 // Dump the persistent handle to the script. This prevents there from being
31 // an ownership cycle that keeps the context alive.
32 m_script.Reset();
33 }
34
35 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698