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

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

Issue 2781303002: [ES6 modules] Introduce ScriptModuleHash (Closed)
Patch Set: rebased 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptModule.h" 5 #include "bindings/core/v8/ScriptModule.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "core/dom/Modulator.h" 8 #include "core/dom/Modulator.h"
9 #include "core/dom/ScriptModuleResolver.h" 9 #include "core/dom/ScriptModuleResolver.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 ScriptModule::ScriptModule(v8::Isolate* isolate, v8::Local<v8::Module> module) 13 ScriptModule::ScriptModule(v8::Isolate* isolate, v8::Local<v8::Module> module)
14 : m_module(SharedPersistent<v8::Module>::create(module, isolate)) {} 14 : m_module(SharedPersistent<v8::Module>::create(module, isolate)),
15 m_identityHash(static_cast<unsigned>(module->GetIdentityHash())) {
16 DCHECK(!m_module->isEmpty());
17 }
15 18
16 ScriptModule::~ScriptModule() {} 19 ScriptModule::~ScriptModule() {}
17 20
18 ScriptModule ScriptModule::compile(v8::Isolate* isolate, 21 ScriptModule ScriptModule::compile(v8::Isolate* isolate,
19 const String& source, 22 const String& source,
20 const String& fileName) { 23 const String& fileName) {
21 v8::TryCatch tryCatch(isolate); 24 v8::TryCatch tryCatch(isolate);
22 tryCatch.SetVerbose(true); 25 tryCatch.SetVerbose(true);
23 v8::Local<v8::Module> module; 26 v8::Local<v8::Module> module;
24 if (!v8Call(V8ScriptRunner::compileModule(isolate, source, fileName), module, 27 if (!v8Call(V8ScriptRunner::compileModule(isolate, source, fileName), module,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (resolved.isNull()) { 98 if (resolved.isNull()) {
96 DCHECK(exceptionState.hadException()); 99 DCHECK(exceptionState.hadException());
97 return v8::MaybeLocal<v8::Module>(); 100 return v8::MaybeLocal<v8::Module>();
98 } 101 }
99 102
100 DCHECK(!exceptionState.hadException()); 103 DCHECK(!exceptionState.hadException());
101 return v8::MaybeLocal<v8::Module>(resolved.m_module->newLocal(isolate)); 104 return v8::MaybeLocal<v8::Module>(resolved.m_module->newLocal(isolate));
102 } 105 }
103 106
104 } // namespace blink 107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698