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

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

Issue 2014323002: Use std::unique_ptr<base::Value> in V8ValueConverter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android fixes Created 4 years, 6 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
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/child/v8_value_converter_impl.h" 9 #include "content/child/v8_value_converter_impl.h"
10 #include "content/common/child_process_messages.h" 10 #include "content/common/child_process_messages.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // Warning: note that JSON officially requires the root-level object to be 95 // Warning: note that JSON officially requires the root-level object to be
96 // an object (e.g. {foo:3}) or an array, while here we're serializing 96 // an object (e.g. {foo:3}) or an array, while here we're serializing
97 // strings, bools, etc. to "JSON". This only works because (a) the JSON 97 // strings, bools, etc. to "JSON". This only works because (a) the JSON
98 // writer is lenient, and (b) on the receiving side we wrap the JSON string 98 // writer is lenient, and (b) on the receiving side we wrap the JSON string
99 // in square brackets, converting it to an array, then parsing it and 99 // in square brackets, converting it to an array, then parsing it and
100 // grabbing the 0th element to get the value out. 100 // grabbing the 0th element to get the value out.
101 if (!args.PeekNext().IsEmpty() && 101 if (!args.PeekNext().IsEmpty() &&
102 (args.PeekNext()->IsString() || args.PeekNext()->IsBoolean() || 102 (args.PeekNext()->IsString() || args.PeekNext()->IsBoolean() ||
103 args.PeekNext()->IsNumber())) { 103 args.PeekNext()->IsNumber())) {
104 V8ValueConverterImpl conv; 104 V8ValueConverterImpl conv;
105 value.reset( 105 value =
106 conv.FromV8Value(args.PeekNext(), args.isolate()->GetCurrentContext())); 106 conv.FromV8Value(args.PeekNext(), args.isolate()->GetCurrentContext());
107 } else { 107 } else {
108 return false; 108 return false;
109 } 109 }
110 110
111 if (!serializer.Serialize(*value)) 111 if (!serializer.Serialize(*value))
112 return false; 112 return false;
113 113
114 bool succeeded = Send(new FrameHostMsg_DomOperationResponse( 114 bool succeeded = Send(new FrameHostMsg_DomOperationResponse(
115 routing_id(), json)); 115 routing_id(), json));
116 116
(...skipping 21 matching lines...) Expand all
138 return Send( 138 return Send(
139 new FrameHostMsg_DomOperationResponse(routing_id(), str)); 139 new FrameHostMsg_DomOperationResponse(routing_id(), str));
140 } 140 }
141 141
142 bool DomAutomationController::SetAutomationId(int automation_id) { 142 bool DomAutomationController::SetAutomationId(int automation_id) {
143 automation_id_ = automation_id; 143 automation_id_ = automation_id;
144 return true; 144 return true;
145 } 145 }
146 146
147 } // namespace content 147 } // namespace content
OLDNEW
« no previous file with comments | « content/public/child/v8_value_converter.h ('k') | content/renderer/gpu/gpu_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698