| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gin/modules/module_registry.h" | 5 #include "gin/modules/module_registry.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 std::vector<v8::Handle<Value> > argv(argc); | 195 std::vector<v8::Handle<Value> > argv(argc); |
| 196 for (uint32_t i = 0; i < argc; ++i) | 196 for (uint32_t i = 0; i < argc; ++i) |
| 197 argv[i] = GetModule(isolate, pending->dependencies[i]); | 197 argv[i] = GetModule(isolate, pending->dependencies[i]); |
| 198 | 198 |
| 199 v8::Handle<Value> module = Local<Value>::New(isolate, pending->factory); | 199 v8::Handle<Value> module = Local<Value>::New(isolate, pending->factory); |
| 200 | 200 |
| 201 v8::Handle<Function> factory; | 201 v8::Handle<Function> factory; |
| 202 if (ConvertFromV8(isolate, module, &factory)) { | 202 if (ConvertFromV8(isolate, module, &factory)) { |
| 203 PerContextData* data = PerContextData::From(isolate->GetCurrentContext()); | 203 PerContextData* data = PerContextData::From(isolate->GetCurrentContext()); |
| 204 Runner* runner = data->runner(); | 204 Runner* runner = data->runner(); |
| 205 module = runner->Call(factory, runner->global(), argc, argv.data()); | 205 module = runner->Call(factory, runner->global(), argc, &argv.front()); |
| 206 if (pending->id.empty()) | 206 if (pending->id.empty()) |
| 207 ConvertFromV8(isolate, factory->GetScriptOrigin().ResourceName(), | 207 ConvertFromV8(isolate, factory->GetScriptOrigin().ResourceName(), |
| 208 &pending->id); | 208 &pending->id); |
| 209 } | 209 } |
| 210 | 210 |
| 211 RegisterModule(isolate, pending->id, module); | 211 RegisterModule(isolate, pending->id, module); |
| 212 } | 212 } |
| 213 | 213 |
| 214 bool ModuleRegistry::AttemptToLoad(Isolate* isolate, | 214 bool ModuleRegistry::AttemptToLoad(Isolate* isolate, |
| 215 scoped_ptr<PendingModule> pending) { | 215 scoped_ptr<PendingModule> pending) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 238 for (size_t i = 0; i < pending_modules.size(); ++i) { | 238 for (size_t i = 0; i < pending_modules.size(); ++i) { |
| 239 scoped_ptr<PendingModule> pending(pending_modules[i]); | 239 scoped_ptr<PendingModule> pending(pending_modules[i]); |
| 240 pending_modules[i] = NULL; | 240 pending_modules[i] = NULL; |
| 241 if (AttemptToLoad(isolate, pending.Pass())) | 241 if (AttemptToLoad(isolate, pending.Pass())) |
| 242 keep_trying = true; | 242 keep_trying = true; |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace gin | 247 } // namespace gin |
| OLD | NEW |