OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/module_system.h" | 5 #include "extensions/renderer/module_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 const std::string& module_field, | 420 const std::string& module_field, |
421 v8::AccessorGetterCallback getter) { | 421 v8::AccessorGetterCallback getter) { |
422 v8::HandleScope handle_scope(GetIsolate()); | 422 v8::HandleScope handle_scope(GetIsolate()); |
423 v8::Handle<v8::Object> parameters = v8::Object::New(GetIsolate()); | 423 v8::Handle<v8::Object> parameters = v8::Object::New(GetIsolate()); |
424 parameters->Set(v8::String::NewFromUtf8(GetIsolate(), kModuleName), | 424 parameters->Set(v8::String::NewFromUtf8(GetIsolate(), kModuleName), |
425 v8::String::NewFromUtf8(GetIsolate(), module_name.c_str())); | 425 v8::String::NewFromUtf8(GetIsolate(), module_name.c_str())); |
426 parameters->Set(v8::String::NewFromUtf8(GetIsolate(), kModuleField), | 426 parameters->Set(v8::String::NewFromUtf8(GetIsolate(), kModuleField), |
427 v8::String::NewFromUtf8(GetIsolate(), module_field.c_str())); | 427 v8::String::NewFromUtf8(GetIsolate(), module_field.c_str())); |
428 object->SetAccessor(v8::String::NewFromUtf8(GetIsolate(), field.c_str()), | 428 object->SetAccessor(v8::String::NewFromUtf8(GetIsolate(), field.c_str()), |
429 getter, | 429 getter, |
430 NULL, | 430 nullptr, |
431 parameters); | 431 parameters); |
432 } | 432 } |
433 | 433 |
434 void ModuleSystem::SetNativeLazyField(v8::Handle<v8::Object> object, | 434 void ModuleSystem::SetNativeLazyField(v8::Handle<v8::Object> object, |
435 const std::string& field, | 435 const std::string& field, |
436 const std::string& module_name, | 436 const std::string& module_name, |
437 const std::string& module_field) { | 437 const std::string& module_field) { |
438 SetLazyField(object, | 438 SetLazyField(object, |
439 field, | 439 field, |
440 module_name, | 440 module_name, |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 v8::Handle<v8::Value> value) { | 661 v8::Handle<v8::Value> value) { |
662 if (!is_valid()) | 662 if (!is_valid()) |
663 return; | 663 return; |
664 v8::HandleScope handle_scope(GetIsolate()); | 664 v8::HandleScope handle_scope(GetIsolate()); |
665 v8::Handle<v8::Promise::Resolver> resolver_local( | 665 v8::Handle<v8::Promise::Resolver> resolver_local( |
666 v8::Local<v8::Promise::Resolver>::New(GetIsolate(), *resolver)); | 666 v8::Local<v8::Promise::Resolver>::New(GetIsolate(), *resolver)); |
667 resolver_local->Resolve(value); | 667 resolver_local->Resolve(value); |
668 } | 668 } |
669 | 669 |
670 } // namespace extensions | 670 } // namespace extensions |
OLD | NEW |