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

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system.h

Issue 10352004: gdata: Implement periodic file system update checks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Bind the ui_weak_ptr_ in a callback to Timer::Start Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/gdata/gdata_file_system.h
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h
index c963adc4545962b8d62a31b362e30ad0933a11fc..12a87c0f687e91178d9e29f58a98f19f7308f7be 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.h
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.h
@@ -18,6 +18,7 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/platform_file.h"
+#include "base/timer.h"
#include "base/synchronization/lock.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/chromeos/gdata/find_entry_delegate.h"
@@ -175,6 +176,10 @@ class GDataFileSystemInterface {
virtual void AddObserver(Observer* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;
+ // Starts and stops periodic updates.
+ virtual void StartUpdates() = 0;
satorux1 2012/05/03 18:46:20 Please also explain a bit more about these functio
hshi 2012/05/03 19:09:19 Done. Although I think "Periodic" may be redundant
satorux1 2012/05/03 19:18:36 Agreed.
+ virtual void StopUpdates() = 0;
+
// Enum defining origin of a cached file.
enum CachedFileOrigin {
CACHED_FILE_FROM_SERVER = 0,
@@ -400,6 +405,8 @@ class GDataFileSystem : public GDataFileSystemInterface,
virtual void Initialize() OVERRIDE;
virtual void AddObserver(Observer* observer) OVERRIDE;
virtual void RemoveObserver(Observer* observer) OVERRIDE;
+ virtual void StartUpdates() OVERRIDE;
+ virtual void StopUpdates() OVERRIDE;
virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE;
virtual void FindEntryByResourceIdSync(const std::string& resource_id,
FindEntryDelegate* delegate) OVERRIDE;
@@ -1303,6 +1310,9 @@ class GDataFileSystem : public GDataFileSystemInterface,
bool to_mount,
const SetMountedStateCallback& callback);
+ // Checks for updates on the server.
+ void CheckForUpdates();
+
scoped_ptr<GDataRootDirectory> root_;
// This guards regular states.
@@ -1333,6 +1343,12 @@ class GDataFileSystem : public GDataFileSystemInterface,
int num_pending_tasks_;
base::Lock num_pending_tasks_lock_;
+ // Number of active update requests.
+ int num_update_requests_;
+
+ // Periodic timer for checking updates.
+ base::RepeatingTimer<GDataFileSystem> update_timer_;
+
// True if hosted documents should be hidden.
bool hide_hosted_docs_;

Powered by Google App Engine
This is Rietveld 408576698