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 "mojo/apps/js/bindings/waiting_callback.h" | 5 #include "mojo/apps/js/bindings/waiting_callback.h" |
6 | 6 |
7 #include "gin/per_context_data.h" | 7 #include "gin/per_context_data.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 namespace js { | 10 namespace js { |
(...skipping 30 matching lines...) Expand all Loading... |
41 static_cast<WaitingCallback*>(closure)->OnHandleReady(result); | 41 static_cast<WaitingCallback*>(closure)->OnHandleReady(result); |
42 } | 42 } |
43 | 43 |
44 void WaitingCallback::OnHandleReady(MojoResult result) { | 44 void WaitingCallback::OnHandleReady(MojoResult result) { |
45 wait_id_ = 0; | 45 wait_id_ = 0; |
46 | 46 |
47 if (!runner_) | 47 if (!runner_) |
48 return; | 48 return; |
49 | 49 |
50 gin::Runner::Scope scope(runner_.get()); | 50 gin::Runner::Scope scope(runner_.get()); |
51 v8::Isolate* isolate = runner_->isolate(); | 51 v8::Isolate* isolate = runner_->GetContextHolder()->isolate(); |
52 | 52 |
53 v8::Handle<v8::Value> hidden_value = | 53 v8::Handle<v8::Value> hidden_value = |
54 GetWrapper(isolate)->GetHiddenValue(GetHiddenPropertyName(isolate)); | 54 GetWrapper(isolate)->GetHiddenValue(GetHiddenPropertyName(isolate)); |
55 v8::Handle<v8::Function> callback; | 55 v8::Handle<v8::Function> callback; |
56 CHECK(gin::ConvertFromV8(isolate, hidden_value, &callback)); | 56 CHECK(gin::ConvertFromV8(isolate, hidden_value, &callback)); |
57 | 57 |
58 v8::Handle<v8::Value> args[] = { gin::ConvertToV8(isolate, result) }; | 58 v8::Handle<v8::Value> args[] = { gin::ConvertToV8(isolate, result) }; |
59 runner_->Call(callback, runner_->global(), 1, args); | 59 runner_->Call(callback, runner_->global(), 1, args); |
60 } | 60 } |
61 | 61 |
62 } // namespace js | 62 } // namespace js |
63 } // namespace mojo | 63 } // namespace mojo |
OLD | NEW |