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

Side by Side Diff: headless/lib/browser/headless_devtools_client_impl.cc

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « extensions/renderer/script_injection.cc ('k') | ios/web/web_state/ui/web_view_js_utils.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "headless/lib/browser/headless_devtools_client_impl.h" 5 #include "headless/lib/browser/headless_devtools_client_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 NOTREACHED() << "Unexpected reply"; 122 NOTREACHED() << "Unexpected reply";
123 return false; 123 return false;
124 } 124 }
125 Callback callback = std::move(it->second); 125 Callback callback = std::move(it->second);
126 pending_messages_.erase(it); 126 pending_messages_.erase(it);
127 if (!callback.callback_with_result.is_null()) { 127 if (!callback.callback_with_result.is_null()) {
128 const base::DictionaryValue* result_dict; 128 const base::DictionaryValue* result_dict;
129 if (message_dict.GetDictionary("result", &result_dict)) { 129 if (message_dict.GetDictionary("result", &result_dict)) {
130 callback.callback_with_result.Run(*result_dict); 130 callback.callback_with_result.Run(*result_dict);
131 } else if (message_dict.GetDictionary("error", &result_dict)) { 131 } else if (message_dict.GetDictionary("error", &result_dict)) {
132 std::unique_ptr<base::Value> null_value = base::Value::CreateNullValue(); 132 auto null_value = base::MakeUnique<base::Value>();
133 DLOG(ERROR) << "Error in method call result: " << *result_dict; 133 DLOG(ERROR) << "Error in method call result: " << *result_dict;
134 callback.callback_with_result.Run(*null_value); 134 callback.callback_with_result.Run(*null_value);
135 } else { 135 } else {
136 NOTREACHED() << "Reply has neither result nor error"; 136 NOTREACHED() << "Reply has neither result nor error";
137 return false; 137 return false;
138 } 138 }
139 } else if (!callback.callback.is_null()) { 139 } else if (!callback.callback.is_null()) {
140 callback.callback.Run(); 140 callback.callback.Run();
141 } 141 }
142 return true; 142 return true;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 HeadlessDevToolsClientImpl::Callback::Callback( 364 HeadlessDevToolsClientImpl::Callback::Callback(
365 base::Callback<void(const base::Value&)> callback) 365 base::Callback<void(const base::Value&)> callback)
366 : callback_with_result(callback) {} 366 : callback_with_result(callback) {}
367 367
368 HeadlessDevToolsClientImpl::Callback::~Callback() {} 368 HeadlessDevToolsClientImpl::Callback::~Callback() {}
369 369
370 HeadlessDevToolsClientImpl::Callback& HeadlessDevToolsClientImpl::Callback:: 370 HeadlessDevToolsClientImpl::Callback& HeadlessDevToolsClientImpl::Callback::
371 operator=(Callback&& other) = default; 371 operator=(Callback&& other) = default;
372 372
373 } // namespace headless 373 } // namespace headless
OLDNEW
« no previous file with comments | « extensions/renderer/script_injection.cc ('k') | ios/web/web_state/ui/web_view_js_utils.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698