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

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

Issue 10836069: Revert 149576 - gdata: Make WeakPtrFactory the last parameter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
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 #include <vector> 10 #include <vector>
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // The root directory of the cache (i.e. <user_profile_dir>/GCache/v1). 423 // The root directory of the cache (i.e. <user_profile_dir>/GCache/v1).
424 const FilePath cache_root_path_; 424 const FilePath cache_root_path_;
425 // Paths for all subdirectories of GCache, one for each 425 // Paths for all subdirectories of GCache, one for each
426 // GDataCache::CacheSubDirectoryType enum. 426 // GDataCache::CacheSubDirectoryType enum.
427 const std::vector<FilePath> cache_paths_; 427 const std::vector<FilePath> cache_paths_;
428 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 428 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
429 429
430 // The cache state data. This member must be access only on the blocking pool. 430 // The cache state data. This member must be access only on the blocking pool.
431 scoped_ptr<GDataCacheMetadata> metadata_; 431 scoped_ptr<GDataCacheMetadata> metadata_;
432 432
433 // WeakPtrFactory and WeakPtr bound to the UI thread.
434 base::WeakPtrFactory<GDataCache> ui_weak_ptr_factory_;
435 base::WeakPtr<GDataCache> ui_weak_ptr_;
436
433 // List of observers, this member must be accessed on UI thread. 437 // List of observers, this member must be accessed on UI thread.
434 ObserverList<Observer> observers_; 438 ObserverList<Observer> observers_;
435 439
436 // Note: This should remain the last member so it'll be destroyed and
437 // invalidate its weak pointers before any other members are destroyed.
438 base::WeakPtrFactory<GDataCache> weak_ptr_factory_;
439 DISALLOW_COPY_AND_ASSIGN(GDataCache); 440 DISALLOW_COPY_AND_ASSIGN(GDataCache);
440 }; 441 };
441 442
442 443
443 // The minimum free space to keep. GDataFileSystem::GetFileByPath() returns 444 // The minimum free space to keep. GDataFileSystem::GetFileByPath() returns
444 // GDATA_FILE_ERROR_NO_SPACE if the available space is smaller than 445 // GDATA_FILE_ERROR_NO_SPACE if the available space is smaller than
445 // this value. 446 // this value.
446 // 447 //
447 // Copied from cryptohome/homedirs.h. 448 // Copied from cryptohome/homedirs.h.
448 // TODO(satorux): Share the constant. 449 // TODO(satorux): Share the constant.
449 const int64 kMinFreeSpace = 512 * 1LL << 20; 450 const int64 kMinFreeSpace = 512 * 1LL << 20;
450 451
451 // Interface class used for getting the free disk space. Only for testing. 452 // Interface class used for getting the free disk space. Only for testing.
452 class FreeDiskSpaceGetterInterface { 453 class FreeDiskSpaceGetterInterface {
453 public: 454 public:
454 virtual ~FreeDiskSpaceGetterInterface() {} 455 virtual ~FreeDiskSpaceGetterInterface() {}
455 virtual int64 AmountOfFreeDiskSpace() const = 0; 456 virtual int64 AmountOfFreeDiskSpace() const = 0;
456 }; 457 };
457 458
458 // Sets the free disk space getter for testing. 459 // Sets the free disk space getter for testing.
459 // The existing getter is deleted. 460 // The existing getter is deleted.
460 void SetFreeDiskSpaceGetterForTesting( 461 void SetFreeDiskSpaceGetterForTesting(
461 FreeDiskSpaceGetterInterface* getter); 462 FreeDiskSpaceGetterInterface* getter);
462 463
463 } // namespace gdata 464 } // namespace gdata
464 465
465 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ 466 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_auth_service.cc ('k') | chrome/browser/chromeos/gdata/gdata_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698