summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 06:08:24 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 06:08:24 +0000
commit1771610df43ea45158fcb5f2776852f1e5f4e92b (patch)
treef32652253b296d125497b25dcc51534e4cbc677a /mojo
parent2b2e427dcaa14737774a166adf38b68666bfad1e (diff)
downloadchromium_src-1771610df43ea45158fcb5f2776852f1e5f4e92b.zip
chromium_src-1771610df43ea45158fcb5f2776852f1e5f4e92b.tar.gz
chromium_src-1771610df43ea45158fcb5f2776852f1e5f4e92b.tar.bz2
Refactors parts of gin:
. Runner no longer extends ContextHolder. It will still have a ContextHolder, but not own it. This enables a couple of things: . Runner no longer need own a v8::Context. . Runner can be lazily created after the ContextHolder. . Runner becomes a (mostly) pure virtual interface. This enables an implementation to execute through blink rather than v8 directly. . What was Runner is now DefaultRunner (and DefaultRunnerDelegate). I'm not a fan of these names, if you have better ideas let me know. Maybe DirectRunner? BUG=none TEST=none R=abarth@chromium.org Review URL: https://codereview.chromium.org/179803007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/apps/js/bindings/gl/context.cc2
-rw-r--r--mojo/apps/js/bindings/waiting_callback.cc2
-rw-r--r--mojo/apps/js/main.cc2
-rw-r--r--mojo/apps/js/mojo_runner_delegate.cc9
-rw-r--r--mojo/apps/js/mojo_runner_delegate.h2
-rw-r--r--mojo/apps/js/test/run_js_tests.cc2
6 files changed, 10 insertions, 9 deletions
diff --git a/mojo/apps/js/bindings/gl/context.cc b/mojo/apps/js/bindings/gl/context.cc
index 612f20e..5f87e48 100644
--- a/mojo/apps/js/bindings/gl/context.cc
+++ b/mojo/apps/js/bindings/gl/context.cc
@@ -170,7 +170,7 @@ void Context::ContextLost() {
if (!runner_)
return;
gin::Runner::Scope scope(runner_.get());
- v8::Isolate* isolate = runner_->isolate();
+ v8::Isolate* isolate = runner_->GetContextHolder()->isolate();
v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New(
isolate, context_lost_callback_);
diff --git a/mojo/apps/js/bindings/waiting_callback.cc b/mojo/apps/js/bindings/waiting_callback.cc
index 87c28bf..9234316 100644
--- a/mojo/apps/js/bindings/waiting_callback.cc
+++ b/mojo/apps/js/bindings/waiting_callback.cc
@@ -48,7 +48,7 @@ void WaitingCallback::OnHandleReady(MojoResult result) {
return;
gin::Runner::Scope scope(runner_.get());
- v8::Isolate* isolate = runner_->isolate();
+ v8::Isolate* isolate = runner_->GetContextHolder()->isolate();
v8::Handle<v8::Value> hidden_value =
GetWrapper(isolate)->GetHiddenValue(GetHiddenPropertyName(isolate));
diff --git a/mojo/apps/js/main.cc b/mojo/apps/js/main.cc
index 50f46d4..26dc5a3 100644
--- a/mojo/apps/js/main.cc
+++ b/mojo/apps/js/main.cc
@@ -27,7 +27,7 @@ void Start(MojoHandle pipe, const std::string& module) {
gin::IsolateHolder instance;
MojoRunnerDelegate delegate;
- gin::Runner runner(&delegate, instance.isolate());
+ gin::ShellRunner runner(&delegate, instance.isolate());
delegate.Start(&runner, pipe, module);
base::MessageLoop::current()->Run();
diff --git a/mojo/apps/js/mojo_runner_delegate.cc b/mojo/apps/js/mojo_runner_delegate.cc
index c160f16..58cb333 100644
--- a/mojo/apps/js/mojo_runner_delegate.cc
+++ b/mojo/apps/js/mojo_runner_delegate.cc
@@ -35,7 +35,7 @@ std::vector<base::FilePath> GetModuleSearchPaths() {
void StartCallback(base::WeakPtr<gin::Runner> runner,
MojoHandle pipe,
v8::Handle<v8::Value> module) {
- v8::Isolate* isolate = runner->isolate();
+ v8::Isolate* isolate = runner->GetContextHolder()->isolate();
v8::Handle<v8::Function> start;
CHECK(gin::ConvertFromV8(isolate, module, &start));
@@ -63,13 +63,14 @@ void MojoRunnerDelegate::Start(gin::Runner* runner,
MojoHandle pipe,
const std::string& module) {
gin::Runner::Scope scope(runner);
- gin::ModuleRegistry* registry = gin::ModuleRegistry::From(runner->context());
- registry->LoadModule(runner->isolate(), module,
+ gin::ModuleRegistry* registry =
+ gin::ModuleRegistry::From(runner->GetContextHolder()->context());
+ registry->LoadModule(runner->GetContextHolder()->isolate(), module,
base::Bind(StartCallback, runner->GetWeakPtr(), pipe));
AttemptToLoadMoreModules(runner);
}
-void MojoRunnerDelegate::UnhandledException(gin::Runner* runner,
+void MojoRunnerDelegate::UnhandledException(gin::ShellRunner* runner,
gin::TryCatch& try_catch) {
gin::ModuleRunnerDelegate::UnhandledException(runner, try_catch);
LOG(ERROR) << try_catch.GetStackTrace();
diff --git a/mojo/apps/js/mojo_runner_delegate.h b/mojo/apps/js/mojo_runner_delegate.h
index aa1393f..04f7449 100644
--- a/mojo/apps/js/mojo_runner_delegate.h
+++ b/mojo/apps/js/mojo_runner_delegate.h
@@ -21,7 +21,7 @@ class MojoRunnerDelegate : public gin::ModuleRunnerDelegate {
private:
// From ModuleRunnerDelegate:
- virtual void UnhandledException(gin::Runner* runner,
+ virtual void UnhandledException(gin::ShellRunner* runner,
gin::TryCatch& try_catch) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(MojoRunnerDelegate);
diff --git a/mojo/apps/js/test/run_js_tests.cc b/mojo/apps/js/test/run_js_tests.cc
index 9de6d7c..30c2ea5 100644
--- a/mojo/apps/js/test/run_js_tests.cc
+++ b/mojo/apps/js/test/run_js_tests.cc
@@ -21,7 +21,7 @@ namespace {
class TestRunnerDelegate : public gin::FileRunnerDelegate {
public:
TestRunnerDelegate() {
- AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
+ AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
AddBuiltinModule(Core::kModuleName, Core::GetModule);
AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule);
AddBuiltinModule(apps::MonotonicClock::kModuleName,