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

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

Issue 1183843002: Do not create GCM store if it is not needed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback + fix test Created 5 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
« no previous file with comments | « google_apis/gcm/engine/mcs_client_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('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 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 gcm_store_.reset( 300 gcm_store_.reset(
301 new GCMStoreImpl(gcm_store_path_, 301 new GCMStoreImpl(gcm_store_path_,
302 file_thread_.message_loop_proxy(), 302 file_thread_.message_loop_proxy(),
303 make_scoped_ptr<Encryptor>(new FakeEncryptor))); 303 make_scoped_ptr<Encryptor>(new FakeEncryptor)));
304 mcs_client_.reset(new MCSClient("probe", 304 mcs_client_.reset(new MCSClient("probe",
305 &clock_, 305 &clock_,
306 connection_factory_.get(), 306 connection_factory_.get(),
307 gcm_store_.get(), 307 gcm_store_.get(),
308 &recorder_)); 308 &recorder_));
309 run_loop_.reset(new base::RunLoop()); 309 run_loop_.reset(new base::RunLoop());
310 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback, 310 gcm_store_->Load(GCMStore::CREATE_IF_MISSING,
311 base::Bind(&MCSProbe::LoadCallback,
311 base::Unretained(this))); 312 base::Unretained(this)));
312 run_loop_->Run(); 313 run_loop_->Run();
313 } 314 }
314 315
315 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) { 316 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) {
316 DCHECK(load_result->success); 317 DCHECK(load_result->success);
317 if (android_id_ != 0 && secret_ != 0) { 318 if (android_id_ != 0 && secret_ != 0) {
318 DVLOG(1) << "Presetting MCS id " << android_id_; 319 DVLOG(1) << "Presetting MCS id " << android_id_;
319 load_result->device_android_id = android_id_; 320 load_result->device_android_id = android_id_;
320 load_result->device_security_token = secret_; 321 load_result->device_security_token = secret_;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 495
495 return 0; 496 return 0;
496 } 497 }
497 498
498 } // namespace 499 } // namespace
499 } // namespace gcm 500 } // namespace gcm
500 501
501 int main(int argc, char* argv[]) { 502 int main(int argc, char* argv[]) {
502 return gcm::MCSProbeMain(argc, argv); 503 return gcm::MCSProbeMain(argc, argv);
503 } 504 }
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/mcs_client_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698