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

Side by Side Diff: components/gcm_driver/instance_id/instance_id_impl.cc

Issue 1899753002: Make InstanceIDBridge fully async to fix strict mode violations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid3test
Patch Set: Fix DeleteID use after free Created 4 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
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 "components/gcm_driver/instance_id/instance_id_impl.h" 5 #include "components/gcm_driver/instance_id/instance_id_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void InstanceIDImpl::OnDeleteTokenCompleted( 204 void InstanceIDImpl::OnDeleteTokenCompleted(
205 const DeleteTokenCallback& callback, 205 const DeleteTokenCallback& callback,
206 gcm::GCMClient::Result result) { 206 gcm::GCMClient::Result result) {
207 callback.Run(GCMClientResultToInstanceIDResult(result)); 207 callback.Run(GCMClientResultToInstanceIDResult(result));
208 } 208 }
209 209
210 void InstanceIDImpl::OnDeleteIDCompleted( 210 void InstanceIDImpl::OnDeleteIDCompleted(
211 const DeleteIDCallback& callback, 211 const DeleteIDCallback& callback,
212 gcm::GCMClient::Result result) { 212 gcm::GCMClient::Result result) {
213 callback.Run(GCMClientResultToInstanceIDResult(result)); 213 callback.Run(GCMClientResultToInstanceIDResult(result));
214 // Now |this| will likely have been deleted.
214 } 215 }
215 216
216 void InstanceIDImpl::GetInstanceIDDataCompleted( 217 void InstanceIDImpl::GetInstanceIDDataCompleted(
217 const std::string& instance_id, 218 const std::string& instance_id,
218 const std::string& extra_data) { 219 const std::string& extra_data) {
219 id_ = instance_id; 220 id_ = instance_id;
220 221
221 if (extra_data.empty()) { 222 if (extra_data.empty()) {
222 creation_time_ = base::Time(); 223 creation_time_ = base::Time();
223 } else { 224 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 id_.erase(std::remove(id_.begin(), id_.end(), '='), id_.end()); 261 id_.erase(std::remove(id_.begin(), id_.end(), '='), id_.end());
261 262
262 creation_time_ = base::Time::Now(); 263 creation_time_ = base::Time::Now();
263 264
264 // Save to the persistent store. 265 // Save to the persistent store.
265 handler_->AddInstanceIDData( 266 handler_->AddInstanceIDData(
266 app_id(), id_, base::Int64ToString(creation_time_.ToInternalValue())); 267 app_id(), id_, base::Int64ToString(creation_time_.ToInternalValue()));
267 } 268 }
268 269
269 } // namespace instance_id 270 } // namespace instance_id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698