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

Side by Side Diff: chrome/browser/chromeos/printing/printers_sync_bridge.cc

Issue 2758643002: Flakiness in SingleClientPrintersSyncTest.EditPrinter (Closed)
Patch Set: all tests Created 3 years, 9 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 | « no previous file | chrome/browser/sync/test/integration/single_client_printers_sync_test.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/chromeos/printing/printers_sync_bridge.h" 5 #include "chrome/browser/chromeos/printing/printers_sync_bridge.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 : owner_(owner), weak_ptr_factory_(this) { 79 : owner_(owner), weak_ptr_factory_(this) {
80 callback.Run(base::Bind(&StoreProxy::OnStoreCreated, 80 callback.Run(base::Bind(&StoreProxy::OnStoreCreated,
81 weak_ptr_factory_.GetWeakPtr())); 81 weak_ptr_factory_.GetWeakPtr()));
82 } 82 }
83 83
84 // Returns true if the store has been initialized. 84 // Returns true if the store has been initialized.
85 bool Ready() { return store_.get() != nullptr; } 85 bool Ready() { return store_.get() != nullptr; }
86 86
87 // Returns a new WriteBatch. 87 // Returns a new WriteBatch.
88 std::unique_ptr<ModelTypeStore::WriteBatch> CreateWriteBatch() { 88 std::unique_ptr<ModelTypeStore::WriteBatch> CreateWriteBatch() {
89 CHECK(store_); 89 DCHECK(store_);
90 return store_->CreateWriteBatch(); 90 return store_->CreateWriteBatch();
91 } 91 }
92 92
93 // Commits writes to the database and updates metadata. 93 // Commits writes to the database and updates metadata.
94 void Commit(std::unique_ptr<ModelTypeStore::WriteBatch> batch) { 94 void Commit(std::unique_ptr<ModelTypeStore::WriteBatch> batch) {
95 CHECK(store_); 95 DCHECK(store_);
96 store_->CommitWriteBatch( 96 store_->CommitWriteBatch(
97 std::move(batch), 97 std::move(batch),
98 base::Bind(&StoreProxy::OnCommit, weak_ptr_factory_.GetWeakPtr())); 98 base::Bind(&StoreProxy::OnCommit, weak_ptr_factory_.GetWeakPtr()));
99 } 99 }
100 100
101 private: 101 private:
102 // Callback for ModelTypeStore initialization. 102 // Callback for ModelTypeStore initialization.
103 void OnStoreCreated(Result result, std::unique_ptr<ModelTypeStore> store) { 103 void OnStoreCreated(Result result, std::unique_ptr<ModelTypeStore> store) {
104 if (result == Result::SUCCESS) { 104 if (result == Result::SUCCESS) {
105 store_ = std::move(store); 105 store_ = std::move(store);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 const std::string& id) const { 349 const std::string& id) const {
350 auto iter = all_data_.find(id); 350 auto iter = all_data_.find(id);
351 if (iter == all_data_.end()) { 351 if (iter == all_data_.end()) {
352 return {}; 352 return {};
353 } 353 }
354 354
355 return {*iter->second}; 355 return {*iter->second};
356 } 356 }
357 357
358 } // namespace chromeos 358 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/single_client_printers_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698