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

Side by Side Diff: gin/modules/module_runner_delegate.cc

Issue 120043008: Add a simple one shot and repeating timer API for Mojo.js. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 7 years 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 | Annotate | Revision Log
OLDNEW
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_runner_delegate.h" 5 #include "gin/modules/module_runner_delegate.h"
6 6
7 #include "gin/modules/module_registry.h" 7 #include "gin/modules/module_registry.h"
8 #include "gin/object_template_builder.h" 8 #include "gin/object_template_builder.h"
9 9
10 namespace gin { 10 namespace gin {
11 11
12 ModuleRunnerDelegate::ModuleRunnerDelegate( 12 ModuleRunnerDelegate::ModuleRunnerDelegate(
13 const std::vector<base::FilePath>& search_paths) 13 const std::vector<base::FilePath>& search_paths)
14 : module_provider_(search_paths) { 14 : module_provider_(search_paths) {
15 } 15 }
16 16
17 ModuleRunnerDelegate::~ModuleRunnerDelegate() { 17 ModuleRunnerDelegate::~ModuleRunnerDelegate() {
18 } 18 }
19 19
20 void ModuleRunnerDelegate::AddBuiltinModule(const std::string& id, 20 void ModuleRunnerDelegate::AddBuiltinModule(const std::string& id,
21 ModuleTemplateGetter templ) { 21 ModuleGetter getter) {
22 builtin_modules_[id] = templ; 22 builtin_modules_[id] = getter;
23 } 23 }
24 24
25 void ModuleRunnerDelegate::AttemptToLoadMoreModules(Runner* runner) { 25 void ModuleRunnerDelegate::AttemptToLoadMoreModules(Runner* runner) {
26 ModuleRegistry* registry = ModuleRegistry::From(runner->context()); 26 ModuleRegistry* registry = ModuleRegistry::From(runner->context());
27 registry->AttemptToLoadMoreModules(runner->isolate()); 27 registry->AttemptToLoadMoreModules(runner->isolate());
28 module_provider_.AttempToLoadModules( 28 module_provider_.AttempToLoadModules(
29 runner, registry->unsatisfied_dependencies()); 29 runner, registry->unsatisfied_dependencies());
30 } 30 }
31 31
32 v8::Handle<v8::ObjectTemplate> ModuleRunnerDelegate::GetGlobalTemplate( 32 v8::Handle<v8::ObjectTemplate> ModuleRunnerDelegate::GetGlobalTemplate(
(...skipping 15 matching lines...) Expand all
48 registry->AddBuiltinModule(runner->isolate(), it->first, 48 registry->AddBuiltinModule(runner->isolate(), it->first,
49 it->second(runner->isolate())); 49 it->second(runner->isolate()));
50 } 50 }
51 } 51 }
52 52
53 void ModuleRunnerDelegate::DidRunScript(Runner* runner) { 53 void ModuleRunnerDelegate::DidRunScript(Runner* runner) {
54 AttemptToLoadMoreModules(runner); 54 AttemptToLoadMoreModules(runner);
55 } 55 }
56 56
57 } // namespace gin 57 } // namespace gin
OLDNEW
« no previous file with comments | « gin/modules/module_runner_delegate.h ('k') | gin/modules/timer.h » ('j') | gin/modules/timer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698