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

Side by Side Diff: google_apis/gcm/tools/mcs_probe.cc

Issue 147193003: [GCM] Fix memory leaks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows Created 6 years, 11 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
« no previous file with comments | « google_apis/gcm/gcm_client_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // A standalone tool for testing MCS connections and the MCS client on their 5 // A standalone tool for testing MCS connections and the MCS client on their
6 // own. 6 // own.
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <cstdio> 9 #include <cstdio>
10 #include <string> 10 #include <string>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 void Start(); 174 void Start();
175 175
176 uint64 android_id() const { return android_id_; } 176 uint64 android_id() const { return android_id_; }
177 uint64 secret() const { return secret_; } 177 uint64 secret() const { return secret_; }
178 178
179 private: 179 private:
180 void CheckIn(); 180 void CheckIn();
181 void InitializeNetworkState(); 181 void InitializeNetworkState();
182 void BuildNetworkSession(); 182 void BuildNetworkSession();
183 183
184 void LoadCallback(const GCMStore::LoadResult& load_result); 184 void LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result);
185 void ErrorCallback(); 185 void ErrorCallback();
186 void OnCheckInCompleted(uint64 android_id, uint64 secret); 186 void OnCheckInCompleted(uint64 android_id, uint64 secret);
187 187
188 base::DefaultClock clock_; 188 base::DefaultClock clock_;
189 189
190 CommandLine command_line_; 190 CommandLine command_line_;
191 191
192 base::FilePath gcm_store_path_; 192 base::FilePath gcm_store_path_;
193 uint64 android_id_; 193 uint64 android_id_;
194 uint64 secret_; 194 uint64 secret_;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 file_thread_.message_loop_proxy())); 273 file_thread_.message_loop_proxy()));
274 mcs_client_.reset(new MCSClient(&clock_, 274 mcs_client_.reset(new MCSClient(&clock_,
275 connection_factory_.get(), 275 connection_factory_.get(),
276 gcm_store_.get())); 276 gcm_store_.get()));
277 run_loop_.reset(new base::RunLoop()); 277 run_loop_.reset(new base::RunLoop());
278 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback, 278 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback,
279 base::Unretained(this))); 279 base::Unretained(this)));
280 run_loop_->Run(); 280 run_loop_->Run();
281 } 281 }
282 282
283 void MCSProbe::LoadCallback(const GCMStore::LoadResult& load_result) { 283 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) {
284 DCHECK(load_result.success); 284 DCHECK(load_result->success);
285 android_id_ = load_result.device_android_id; 285 android_id_ = load_result->device_android_id;
286 secret_ = load_result.device_security_token; 286 secret_ = load_result->device_security_token;
287 mcs_client_->Initialize( 287 mcs_client_->Initialize(
288 base::Bind(&MCSProbe::ErrorCallback, base::Unretained(this)), 288 base::Bind(&MCSProbe::ErrorCallback, base::Unretained(this)),
289 base::Bind(&MessageReceivedCallback), 289 base::Bind(&MessageReceivedCallback),
290 base::Bind(&MessageSentCallback), 290 base::Bind(&MessageSentCallback),
291 load_result); 291 load_result.Pass());
292 292
293 if (!android_id_ || !secret_) { 293 if (!android_id_ || !secret_) {
294 CheckIn(); 294 CheckIn();
295 return; 295 return;
296 } 296 }
297 297
298 mcs_client_->Login(android_id_, secret_); 298 mcs_client_->Login(android_id_, secret_);
299 } 299 }
300 300
301 void MCSProbe::InitializeNetworkState() { 301 void MCSProbe::InitializeNetworkState() {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 return 0; 424 return 0;
425 } 425 }
426 426
427 } // namespace 427 } // namespace
428 } // namespace gcm 428 } // namespace gcm
429 429
430 int main(int argc, char* argv[]) { 430 int main(int argc, char* argv[]) {
431 return gcm::MCSProbeMain(argc, argv); 431 return gcm::MCSProbeMain(argc, argv);
432 } 432 }
OLDNEW
« no previous file with comments | « google_apis/gcm/gcm_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698