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

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

Issue 2781303002: [ES6 modules] Introduce ScriptModuleHash (Closed)
Patch Set: remove defaults 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 8
9 namespace blink { 9 namespace blink {
10 10
11 ScriptModule::ScriptModule(v8::Isolate* isolate, v8::Local<v8::Module> module) 11 ScriptModule::ScriptModule(v8::Isolate* isolate, v8::Local<v8::Module> module)
12 : m_module(SharedPersistent<v8::Module>::create(module, isolate)) {} 12 : m_module(SharedPersistent<v8::Module>::create(module, isolate)),
13 m_identityHash(static_cast<unsigned>(module->GetIdentityHash())) {}
13 14
14 ScriptModule::~ScriptModule() {} 15 ScriptModule::~ScriptModule() {}
15 16
16 ScriptModule ScriptModule::compile(v8::Isolate* isolate, 17 ScriptModule ScriptModule::compile(v8::Isolate* isolate,
17 const String& source, 18 const String& source,
18 const String& fileName) { 19 const String& fileName) {
19 v8::TryCatch tryCatch(isolate); 20 v8::TryCatch tryCatch(isolate);
20 tryCatch.SetVerbose(true); 21 tryCatch.SetVerbose(true);
21 v8::Local<v8::Module> module; 22 v8::Local<v8::Module> module;
22 if (!v8Call(V8ScriptRunner::compileModule(isolate, source, fileName), module, 23 if (!v8Call(V8ScriptRunner::compileModule(isolate, source, fileName), module,
(...skipping 24 matching lines...) Expand all
47 tryCatch.SetVerbose(true); 48 tryCatch.SetVerbose(true);
48 v8::Local<v8::Value> result; 49 v8::Local<v8::Value> result;
49 if (!v8Call(V8ScriptRunner::evaluateModule(m_module->newLocal(isolate), 50 if (!v8Call(V8ScriptRunner::evaluateModule(m_module->newLocal(isolate),
50 scriptState->context(), isolate), 51 scriptState->context(), isolate),
51 result, tryCatch)) { 52 result, tryCatch)) {
52 // TODO(adamk): report error 53 // TODO(adamk): report error
53 } 54 }
54 } 55 }
55 56
56 } // namespace blink 57 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698