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

Side by Side Diff: mojo/public/bindings/js/waiting_callback.cc

Issue 94483002: Remove usage of deprecated V8 APIs from mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « mojo/public/bindings/js/support.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "mojo/public/bindings/js/waiting_callback.h" 5 #include "mojo/public/bindings/js/waiting_callback.h"
6 6
7 #include "gin/per_context_data.h" 7 #include "gin/per_context_data.h"
8 #include "gin/per_isolate_data.h" 8 #include "gin/per_isolate_data.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 27 matching lines...) Expand all
38 gin::WrapperInfo WaitingCallback::kWrapperInfo = { gin::kEmbedderNativeGin }; 38 gin::WrapperInfo WaitingCallback::kWrapperInfo = { gin::kEmbedderNativeGin };
39 39
40 gin::WrapperInfo* WaitingCallback::GetWrapperInfo() { 40 gin::WrapperInfo* WaitingCallback::GetWrapperInfo() {
41 return &kWrapperInfo; 41 return &kWrapperInfo;
42 } 42 }
43 43
44 void WaitingCallback::EnsureRegistered(v8::Isolate* isolate) { 44 void WaitingCallback::EnsureRegistered(v8::Isolate* isolate) {
45 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 45 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
46 if (!data->GetObjectTemplate(&kWrapperInfo).IsEmpty()) 46 if (!data->GetObjectTemplate(&kWrapperInfo).IsEmpty())
47 return; 47 return;
48 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(); 48 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
49 templ->SetInternalFieldCount(gin::kNumberOfInternalFields); 49 templ->SetInternalFieldCount(gin::kNumberOfInternalFields);
50 data->SetObjectTemplate(&kWrapperInfo, templ); 50 data->SetObjectTemplate(&kWrapperInfo, templ);
51 } 51 }
52 52
53 void WaitingCallback::OnHandleReady(MojoResult result) { 53 void WaitingCallback::OnHandleReady(MojoResult result) {
54 wait_id_ = NULL; 54 wait_id_ = NULL;
55 55
56 if (!runner_) 56 if (!runner_)
57 return; 57 return;
58 58
59 gin::Runner::Scope scope(runner_.get()); 59 gin::Runner::Scope scope(runner_.get());
60 v8::Isolate* isolate = runner_->isolate(); 60 v8::Isolate* isolate = runner_->isolate();
61 61
62 v8::Handle<v8::Value> hidden_value = 62 v8::Handle<v8::Value> hidden_value =
63 GetWrapper(isolate)->GetHiddenValue(GetHiddenPropertyName(isolate)); 63 GetWrapper(isolate)->GetHiddenValue(GetHiddenPropertyName(isolate));
64 v8::Handle<v8::Function> callback; 64 v8::Handle<v8::Function> callback;
65 CHECK(gin::ConvertFromV8(isolate, hidden_value, &callback)); 65 CHECK(gin::ConvertFromV8(isolate, hidden_value, &callback));
66 66
67 v8::Handle<v8::Value> args[] = { gin::ConvertToV8(isolate, result) }; 67 v8::Handle<v8::Value> args[] = { gin::ConvertToV8(isolate, result) };
68 runner_->Call(callback, runner_->global(), 1, args); 68 runner_->Call(callback, runner_->global(), 1, args);
69 } 69 }
70 70
71 } // namespace js 71 } // namespace js
72 } // namespace mojo 72 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/bindings/js/support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698