| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 Handle<String> GetHiddenValueKey(Isolate* isolate) { | 90 Handle<String> GetHiddenValueKey(Isolate* isolate) { |
| 91 return StringToSymbol(isolate, "::gin::ModuleRegistry"); | 91 return StringToSymbol(isolate, "::gin::ModuleRegistry"); |
| 92 } | 92 } |
| 93 | 93 |
| 94 std::string GetImplicitModuleName(const std::string& explicit_name) { | 94 std::string GetImplicitModuleName(const std::string& explicit_name) { |
| 95 if (!explicit_name.empty()) | 95 if (!explicit_name.empty()) |
| 96 return explicit_name; | 96 return explicit_name; |
| 97 std::string implicit_name; | 97 std::string implicit_name; |
| 98 Handle<StackTrace> trace = StackTrace::CurrentStackTrace(1); | 98 Handle<StackTrace> trace = StackTrace::CurrentStackTrace(1); |
| 99 if (!trace->GetFrameCount()) |
| 100 return implicit_name; |
| 99 Handle<String> script_name = trace->GetFrame(0)->GetScriptName(); | 101 Handle<String> script_name = trace->GetFrame(0)->GetScriptName(); |
| 100 if (!script_name.IsEmpty()) | 102 if (!script_name.IsEmpty()) |
| 101 ConvertFromV8(script_name, &implicit_name); | 103 ConvertFromV8(script_name, &implicit_name); |
| 102 return implicit_name; | 104 return implicit_name; |
| 103 } | 105 } |
| 104 | 106 |
| 105 } // namespace | 107 } // namespace |
| 106 | 108 |
| 107 ModuleRegistry::ModuleRegistry(Isolate* isolate) | 109 ModuleRegistry::ModuleRegistry(Isolate* isolate) |
| 108 : modules_(isolate, Object::New()) { | 110 : modules_(isolate, Object::New()) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 for (size_t i = 0; i < pending_modules.size(); ++i) { | 222 for (size_t i = 0; i < pending_modules.size(); ++i) { |
| 221 scoped_ptr<PendingModule> pending(pending_modules[i]); | 223 scoped_ptr<PendingModule> pending(pending_modules[i]); |
| 222 pending_modules[i] = NULL; | 224 pending_modules[i] = NULL; |
| 223 if (AttemptToLoad(isolate, pending.Pass())) | 225 if (AttemptToLoad(isolate, pending.Pass())) |
| 224 keep_trying = true; | 226 keep_trying = true; |
| 225 } | 227 } |
| 226 } | 228 } |
| 227 } | 229 } |
| 228 | 230 |
| 229 } // namespace gin | 231 } // namespace gin |
| OLD | NEW |