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

Side by Side Diff: content/renderer/dom_automation_controller.cc

Issue 259993003: Make sure gin Handles exist before using them (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 years, 7 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/dom_automation_controller.h" 5 #include "content/renderer/dom_automation_controller.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/common/child_process_messages.h" 9 #include "content/common/child_process_messages.h"
10 #include "content/common/frame_messages.h" 10 #include "content/common/frame_messages.h"
(...skipping 15 matching lines...) Expand all
26 v8::Isolate* isolate = blink::mainThreadIsolate(); 26 v8::Isolate* isolate = blink::mainThreadIsolate();
27 v8::HandleScope handle_scope(isolate); 27 v8::HandleScope handle_scope(isolate);
28 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); 28 v8::Handle<v8::Context> context = frame->mainWorldScriptContext();
29 if (context.IsEmpty()) 29 if (context.IsEmpty())
30 return; 30 return;
31 31
32 v8::Context::Scope context_scope(context); 32 v8::Context::Scope context_scope(context);
33 33
34 gin::Handle<DomAutomationController> controller = 34 gin::Handle<DomAutomationController> controller =
35 gin::CreateHandle(isolate, new DomAutomationController(render_frame)); 35 gin::CreateHandle(isolate, new DomAutomationController(render_frame));
36 if (controller.IsEmpty())
37 return;
38
36 v8::Handle<v8::Object> global = context->Global(); 39 v8::Handle<v8::Object> global = context->Global();
37 global->Set(gin::StringToV8(isolate, "domAutomationController"), 40 global->Set(gin::StringToV8(isolate, "domAutomationController"),
38 controller.ToV8()); 41 controller.ToV8());
39 } 42 }
40 43
41 DomAutomationController::DomAutomationController(RenderFrame* render_frame) 44 DomAutomationController::DomAutomationController(RenderFrame* render_frame)
42 : RenderFrameObserver(render_frame), automation_id_(MSG_ROUTING_NONE) {} 45 : RenderFrameObserver(render_frame), automation_id_(MSG_ROUTING_NONE) {}
43 46
44 DomAutomationController::~DomAutomationController() {} 47 DomAutomationController::~DomAutomationController() {}
45 48
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return Send( 114 return Send(
112 new FrameHostMsg_DomOperationResponse(routing_id(), str, automation_id)); 115 new FrameHostMsg_DomOperationResponse(routing_id(), str, automation_id));
113 } 116 }
114 117
115 bool DomAutomationController::SetAutomationId(int automation_id) { 118 bool DomAutomationController::SetAutomationId(int automation_id) {
116 automation_id_ = automation_id; 119 automation_id_ = automation_id;
117 return true; 120 return true;
118 } 121 }
119 122
120 } // namespace content 123 } // namespace content
OLDNEW
« no previous file with comments | « chrome/renderer/net/net_error_page_controller.cc ('k') | content/renderer/memory_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698