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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_cache.h

Issue 10702154: gdata: Fix weird code in GDataCache::CacheEntry::Set* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | 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 (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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 bool IsDirty() const { return cache_state & CACHE_STATE_DIRTY; } 138 bool IsDirty() const { return cache_state & CACHE_STATE_DIRTY; }
139 139
140 // Returns true if the file is a mounted archive file. 140 // Returns true if the file is a mounted archive file.
141 bool IsMounted() const { return cache_state & CACHE_STATE_MOUNTED; } 141 bool IsMounted() const { return cache_state & CACHE_STATE_MOUNTED; }
142 142
143 // Returns true if the file is in the persistent directory. 143 // Returns true if the file is in the persistent directory.
144 bool IsPersistent() const { return cache_state & CACHE_STATE_PERSISTENT; } 144 bool IsPersistent() const { return cache_state & CACHE_STATE_PERSISTENT; }
145 145
146 // Setters for the states describe above. 146 // Setters for the states describe above.
147 void SetPresent(bool value) { 147 void SetPresent(bool value) {
148 cache_state = (value ? cache_state |= CACHE_STATE_PRESENT : 148 if (value)
149 cache_state &= ~CACHE_STATE_PRESENT); 149 cache_state |= CACHE_STATE_PRESENT;
150 else
151 cache_state &= ~CACHE_STATE_PRESENT;
150 } 152 }
151 void SetPinned(bool value) { 153 void SetPinned(bool value) {
152 cache_state = (value ? cache_state |= CACHE_STATE_PINNED : 154 if (value)
153 cache_state &= ~CACHE_STATE_PINNED); 155 cache_state |= CACHE_STATE_PINNED;
156 else
157 cache_state &= ~CACHE_STATE_PINNED;
154 } 158 }
155 void SetDirty(bool value) { 159 void SetDirty(bool value) {
156 cache_state = (value ? cache_state |= CACHE_STATE_DIRTY : 160 if (value)
157 cache_state &= ~CACHE_STATE_DIRTY); 161 cache_state |= CACHE_STATE_DIRTY;
162 else
163 cache_state &= ~CACHE_STATE_DIRTY;
158 } 164 }
159 void SetMounted(bool value) { 165 void SetMounted(bool value) {
160 cache_state = (value ? cache_state |= CACHE_STATE_MOUNTED : 166 if (value)
161 cache_state &= ~CACHE_STATE_MOUNTED); 167 cache_state |= CACHE_STATE_MOUNTED;
168 else
169 cache_state &= ~CACHE_STATE_MOUNTED;
162 } 170 }
163 void SetPersistent(bool value) { 171 void SetPersistent(bool value) {
164 cache_state = (value ? cache_state |= CACHE_STATE_PERSISTENT : 172 if (value)
165 cache_state &= ~CACHE_STATE_PERSISTENT); 173 cache_state |= CACHE_STATE_PERSISTENT;
174 else
175 cache_state &= ~CACHE_STATE_PERSISTENT;
166 } 176 }
167 177
168 // Returns the type of the sub directory where the cache file is stored. 178 // Returns the type of the sub directory where the cache file is stored.
169 CacheSubDirectoryType GetSubDirectoryType() const { 179 CacheSubDirectoryType GetSubDirectoryType() const {
170 return IsPersistent() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; 180 return IsPersistent() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP;
171 } 181 }
172 182
173 // For debugging purposes. 183 // For debugging purposes.
174 std::string ToString() const; 184 std::string ToString() const;
175 185
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 }; 520 };
511 521
512 // Sets the free disk space getter for testing. 522 // Sets the free disk space getter for testing.
513 // The existing getter is deleted. 523 // The existing getter is deleted.
514 void SetFreeDiskSpaceGetterForTesting( 524 void SetFreeDiskSpaceGetterForTesting(
515 FreeDiskSpaceGetterInterface* getter); 525 FreeDiskSpaceGetterInterface* getter);
516 526
517 } // namespace gdata 527 } // namespace gdata
518 528
519 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ 529 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698