| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/messaging_bindings.h" | 5 #include "extensions/renderer/messaging_bindings.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 : object_(object), callback_(callback), isolate_(isolate) {} | 209 : object_(object), callback_(callback), isolate_(isolate) {} |
| 210 | 210 |
| 211 void RunCallback() { | 211 void RunCallback() { |
| 212 v8::HandleScope handle_scope(isolate_); | 212 v8::HandleScope handle_scope(isolate_); |
| 213 v8::Handle<v8::Function> callback = callback_.NewHandle(isolate_); | 213 v8::Handle<v8::Function> callback = callback_.NewHandle(isolate_); |
| 214 v8::Handle<v8::Context> context = callback->CreationContext(); | 214 v8::Handle<v8::Context> context = callback->CreationContext(); |
| 215 if (context.IsEmpty()) | 215 if (context.IsEmpty()) |
| 216 return; | 216 return; |
| 217 v8::Context::Scope context_scope(context); | 217 v8::Context::Scope context_scope(context); |
| 218 blink::WebScopedMicrotaskSuppression suppression; | 218 blink::WebScopedMicrotaskSuppression suppression; |
| 219 callback->Call(context->Global(), 0, NULL); | 219 callback->Call(context->Global(), 0, nullptr); |
| 220 } | 220 } |
| 221 | 221 |
| 222 ScopedPersistent<v8::Object> object_; | 222 ScopedPersistent<v8::Object> object_; |
| 223 ScopedPersistent<v8::Function> callback_; | 223 ScopedPersistent<v8::Function> callback_; |
| 224 v8::Isolate* isolate_; | 224 v8::Isolate* isolate_; |
| 225 | 225 |
| 226 DISALLOW_COPY_AND_ASSIGN(GCCallback); | 226 DISALLOW_COPY_AND_ASSIGN(GCCallback); |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 // void BindToGC(object, callback) | 229 // void BindToGC(object, callback) |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 const ScriptContextSet& context_set, | 425 const ScriptContextSet& context_set, |
| 426 int port_id, | 426 int port_id, |
| 427 const std::string& error_message, | 427 const std::string& error_message, |
| 428 content::RenderView* restrict_to_render_view) { | 428 content::RenderView* restrict_to_render_view) { |
| 429 context_set.ForEach( | 429 context_set.ForEach( |
| 430 restrict_to_render_view, | 430 restrict_to_render_view, |
| 431 base::Bind(&DispatchOnDisconnectToScriptContext, port_id, error_message)); | 431 base::Bind(&DispatchOnDisconnectToScriptContext, port_id, error_message)); |
| 432 } | 432 } |
| 433 | 433 |
| 434 } // namespace extensions | 434 } // namespace extensions |
| OLD | NEW |