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

Side by Side Diff: google_apis/gcm/engine/gcm_store_impl.cc

Issue 1135793002: Using ThreadTaskRunnerHandle in lieu of MessageLoopProxy in google_apis module (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « google_apis/gaia/ubertoken_fetcher_unittest.cc ('k') | google_apis/gcm/tools/mcs_probe.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "google_apis/gcm/engine/gcm_store_impl.h" 5 #include "google_apis/gcm/engine/gcm_store_impl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop/message_loop_proxy.h"
14 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
15 #include "base/profiler/scoped_tracker.h" 14 #include "base/profiler/scoped_tracker.h"
16 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
17 #include "base/stl_util.h" 16 #include "base/stl_util.h"
18 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
20 #include "base/strings/string_tokenizer.h" 19 #include "base/strings/string_tokenizer.h"
20 #include "base/thread_task_runner_handle.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "base/tracked_objects.h" 22 #include "base/tracked_objects.h"
23 #include "google_apis/gcm/base/encryptor.h" 23 #include "google_apis/gcm/base/encryptor.h"
24 #include "google_apis/gcm/base/mcs_message.h" 24 #include "google_apis/gcm/base/mcs_message.h"
25 #include "google_apis/gcm/base/mcs_util.h" 25 #include "google_apis/gcm/base/mcs_util.h"
26 #include "google_apis/gcm/protocol/mcs.pb.h" 26 #include "google_apis/gcm/protocol/mcs.pb.h"
27 #include "third_party/leveldatabase/env_chromium.h" 27 #include "third_party/leveldatabase/env_chromium.h"
28 #include "third_party/leveldatabase/src/include/leveldb/db.h" 28 #include "third_party/leveldatabase/src/include/leveldb/db.h"
29 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" 29 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
30 30
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1020 }
1021 1021
1022 return true; 1022 return true;
1023 } 1023 }
1024 1024
1025 GCMStoreImpl::GCMStoreImpl( 1025 GCMStoreImpl::GCMStoreImpl(
1026 const base::FilePath& path, 1026 const base::FilePath& path,
1027 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, 1027 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
1028 scoped_ptr<Encryptor> encryptor) 1028 scoped_ptr<Encryptor> encryptor)
1029 : backend_(new Backend(path, 1029 : backend_(new Backend(path,
1030 base::MessageLoopProxy::current(), 1030 base::ThreadTaskRunnerHandle::Get(),
1031 encryptor.Pass())), 1031 encryptor.Pass())),
1032 blocking_task_runner_(blocking_task_runner), 1032 blocking_task_runner_(blocking_task_runner),
1033 weak_ptr_factory_(this) { 1033 weak_ptr_factory_(this) {
1034 } 1034 }
1035 1035
1036 GCMStoreImpl::~GCMStoreImpl() {} 1036 GCMStoreImpl::~GCMStoreImpl() {}
1037 1037
1038 void GCMStoreImpl::Load(const LoadCallback& callback) { 1038 void GCMStoreImpl::Load(const LoadCallback& callback) {
1039 blocking_task_runner_->PostTask( 1039 blocking_task_runner_->PostTask(
1040 FROM_HERE, 1040 FROM_HERE,
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 removed_message_counts.begin(); 1337 removed_message_counts.begin();
1338 iter != removed_message_counts.end(); ++iter) { 1338 iter != removed_message_counts.end(); ++iter) {
1339 DCHECK_NE(app_message_counts_.count(iter->first), 0U); 1339 DCHECK_NE(app_message_counts_.count(iter->first), 0U);
1340 app_message_counts_[iter->first] -= iter->second; 1340 app_message_counts_[iter->first] -= iter->second;
1341 DCHECK_GE(app_message_counts_[iter->first], 0); 1341 DCHECK_GE(app_message_counts_[iter->first], 0);
1342 } 1342 }
1343 callback.Run(true); 1343 callback.Run(true);
1344 } 1344 }
1345 1345
1346 } // namespace gcm 1346 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gaia/ubertoken_fetcher_unittest.cc ('k') | google_apis/gcm/tools/mcs_probe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698