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

Side by Side Diff: rlz/chromeos/lib/rlz_value_store_chromeos.cc

Issue 11275284: [cros,rlz] Financial ping livelock fix and proper shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert ps#2 Created 8 years, 1 month 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 | « rlz/chromeos/lib/rlz_value_store_chromeos.h ('k') | rlz/lib/financial_ping.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "rlz/chromeos/lib/rlz_value_store_chromeos.h" 5 #include "rlz/chromeos/lib/rlz_value_store_chromeos.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 io_task_runner_->AddRef(); 83 io_task_runner_->AddRef();
84 } 84 }
85 85
86 // static 86 // static
87 void RlzValueStoreChromeOS::ResetForTesting() { 87 void RlzValueStoreChromeOS::ResetForTesting() {
88 // Make sure we don't create an instance if it didn't exist. 88 // Make sure we don't create an instance if it didn't exist.
89 if (created_) 89 if (created_)
90 GetInstance()->ReadPrefs(); 90 GetInstance()->ReadPrefs();
91 } 91 }
92 92
93 // static
94 void RlzValueStoreChromeOS::Cleanup() {
95 if (created_)
96 GetInstance()->rlz_store_ = NULL;
97 }
98
93 RlzValueStoreChromeOS::RlzValueStoreChromeOS() { 99 RlzValueStoreChromeOS::RlzValueStoreChromeOS() {
94 ReadPrefs(); 100 ReadPrefs();
95 created_ = true; 101 created_ = true;
96 } 102 }
97 103
98 RlzValueStoreChromeOS::~RlzValueStoreChromeOS() { 104 RlzValueStoreChromeOS::~RlzValueStoreChromeOS() {
99 } 105 }
100 106
101 bool RlzValueStoreChromeOS::HasAccess(AccessType type) { 107 bool RlzValueStoreChromeOS::HasAccess(AccessType type) {
102 return type == kReadAccess || !rlz_store_->ReadOnly(); 108 return type == kReadAccess || !rlz_store_->ReadOnly();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 rlz_store_->MarkNeedsEmptyValue(list_name); 262 rlz_store_->MarkNeedsEmptyValue(list_name);
257 size_t index; 263 size_t index;
258 if (list->Remove(value, &index)) 264 if (list->Remove(value, &index))
259 rlz_store_->ReportValueChanged(list_name); 265 rlz_store_->ReportValueChanged(list_name);
260 return true; 266 return true;
261 } 267 }
262 268
263 269
264 ScopedRlzValueStoreLock::ScopedRlzValueStoreLock() 270 ScopedRlzValueStoreLock::ScopedRlzValueStoreLock()
265 : store_(RlzValueStoreChromeOS::GetInstance()) { 271 : store_(RlzValueStoreChromeOS::GetInstance()) {
266 DCHECK(store_->CalledOnValidThread());
267 } 272 }
268 273
269 ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() { 274 ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() {
270 } 275 }
271 276
272 RlzValueStore* ScopedRlzValueStoreLock::GetStore() { 277 RlzValueStore* ScopedRlzValueStoreLock::GetStore() {
273 return store_; 278 return store_;
274 } 279 }
275 280
276 namespace testing { 281 namespace testing {
277 282
278 void SetRlzStoreDirectory(const FilePath& directory) { 283 void SetRlzStoreDirectory(const FilePath& directory) {
279 g_testing_rlz_store_path_ = directory; 284 g_testing_rlz_store_path_ = directory;
280 } 285 }
281 286
282 } // namespace testing 287 } // namespace testing
283 288
284 } // namespace rlz_lib 289 } // namespace rlz_lib
OLDNEW
« no previous file with comments | « rlz/chromeos/lib/rlz_value_store_chromeos.h ('k') | rlz/lib/financial_ping.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698