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

Side by Side Diff: remoting/host/gcd_rest_client.cc

Issue 2285933003: Remove more usage of the base::ListValue::Append(Value*) overload. (Closed)
Patch Set: rebase Created 4 years, 3 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 | « remoting/client/plugin/chromoting_instance.cc ('k') | skia/ext/benchmarking_canvas.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/host/gcd_rest_client.h" 5 #include "remoting/host/gcd_rest_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // }] 50 // }]
51 // } 51 // }
52 // 52 //
53 // Note that |now| is deliberately using a double to hold an integer 53 // Note that |now| is deliberately using a double to hold an integer
54 // value because |DictionaryValue| doesn't support int64_t values, and 54 // value because |DictionaryValue| doesn't support int64_t values, and
55 // GCD doesn't accept fractional values. 55 // GCD doesn't accept fractional values.
56 double now = clock_->Now().ToJavaTime(); 56 double now = clock_->Now().ToJavaTime();
57 std::unique_ptr<base::DictionaryValue> patch_dict(new base::DictionaryValue); 57 std::unique_ptr<base::DictionaryValue> patch_dict(new base::DictionaryValue);
58 patch_dict->SetDouble("requestTimeMs", now); 58 patch_dict->SetDouble("requestTimeMs", now);
59 std::unique_ptr<base::ListValue> patch_list(new base::ListValue); 59 std::unique_ptr<base::ListValue> patch_list(new base::ListValue);
60 base::DictionaryValue* patch_item = new base::DictionaryValue; 60 std::unique_ptr<base::DictionaryValue> patch_item(new base::DictionaryValue);
61 patch_list->Append(patch_item);
62 patch_item->Set("patch", std::move(patch_details)); 61 patch_item->Set("patch", std::move(patch_details));
63 patch_item->SetDouble("timeMs", now); 62 patch_item->SetDouble("timeMs", now);
63 patch_list->Append(std::move(patch_item));
64 patch_dict->Set("patches", std::move(patch_list)); 64 patch_dict->Set("patches", std::move(patch_list));
65 65
66 // Stringify the message. 66 // Stringify the message.
67 std::string patch_string; 67 std::string patch_string;
68 if (!base::JSONWriter::Write(*patch_dict, &patch_string)) { 68 if (!base::JSONWriter::Write(*patch_dict, &patch_string)) {
69 LOG(ERROR) << "Error building GCD device state patch."; 69 LOG(ERROR) << "Error building GCD device state patch.";
70 callback.Run(OTHER_ERROR); 70 callback.Run(OTHER_ERROR);
71 return; 71 return;
72 } 72 }
73 DLOG(INFO) << "sending state patch: " << patch_string; 73 DLOG(INFO) << "sending state patch: " << patch_string;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 << ") fetching URL: " << request_url; 137 << ") fetching URL: " << request_url;
138 status = NETWORK_ERROR; 138 status = NETWORK_ERROR;
139 } else { 139 } else {
140 LOG(ERROR) << "Error (" << response << ") fetching URL: " << request_url; 140 LOG(ERROR) << "Error (" << response << ") fetching URL: " << request_url;
141 } 141 }
142 142
143 FinishCurrentRequest(status); 143 FinishCurrentRequest(status);
144 } 144 }
145 145
146 } // namespace remoting 146 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | skia/ext/benchmarking_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698