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

Side by Side Diff: chrome/browser/chromeos/drive/drive_prefetcher.h

Issue 11360027: drive: prefetcher compares last modified time in addition to last access time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | chrome/browser/chromeos/drive/drive_prefetcher.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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/chromeos/drive/drive.pb.h"
15 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" 16 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
16 #include "chrome/browser/chromeos/drive/drive_file_system_observer.h" 17 #include "chrome/browser/chromeos/drive/drive_file_system_observer.h"
17 #include "chrome/browser/chromeos/drive/drive_sync_client_observer.h" 18 #include "chrome/browser/chromeos/drive/drive_sync_client_observer.h"
18 #include "chrome/browser/google_apis/gdata_errorcode.h" 19 #include "chrome/browser/google_apis/gdata_errorcode.h"
19 20
20 class FilePath; 21 class FilePath;
21 22
22 namespace drive { 23 namespace drive {
23 24
24 class DriveEntryProto;
25 class DriveFileSystemInterface; 25 class DriveFileSystemInterface;
26 26
27 // The parameters for DrivePrefetcher construction. 27 // The parameters for DrivePrefetcher construction.
28 struct DrivePrefetcherOptions { 28 struct DrivePrefetcherOptions {
29 DrivePrefetcherOptions(); // Sets the default values. 29 DrivePrefetcherOptions(); // Sets the default values.
30 30
31 int initial_prefetch_count; 31 int initial_prefetch_count;
32 int64 prefetch_file_size_limit; 32 int64 prefetch_file_size_limit;
33 }; 33 };
34 34
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Helper methods to traverse over the file system. 72 // Helper methods to traverse over the file system.
73 void VisitFile(const DriveEntryProto& entry); 73 void VisitFile(const DriveEntryProto& entry);
74 void VisitDirectory(const FilePath& directory_path); 74 void VisitDirectory(const FilePath& directory_path);
75 void OnReadDirectory(const FilePath& directory_path, 75 void OnReadDirectory(const FilePath& directory_path,
76 DriveFileError error, 76 DriveFileError error,
77 bool hide_hosted_documents, 77 bool hide_hosted_documents,
78 scoped_ptr<DriveEntryProtoVector> entries); 78 scoped_ptr<DriveEntryProtoVector> entries);
79 void OnReadDirectoryFinished(); 79 void OnReadDirectoryFinished();
80 80
81 // Keeps the kNumberOfLatestFilesToKeepInCache latest files in the filesystem. 81 // Keeps the kNumberOfLatestFilesToKeepInCache latest files in the filesystem.
82 typedef std::set<std::pair<int64, std::string> > LatestFileSet; 82 typedef bool (*PrefetchPriorityComparator)(const DriveEntryProto&,
83 const DriveEntryProto&);
84 typedef std::set<DriveEntryProto, PrefetchPriorityComparator> LatestFileSet;
83 LatestFileSet latest_files_; 85 LatestFileSet latest_files_;
84 86
85 // The queue of files to fetch. Files with higher priority comes front. 87 // The queue of files to fetch. Files with higher priority comes front.
86 std::deque<std::string> queue_; 88 std::deque<std::string> queue_;
87 89
88 // Number of in-flight |ExecuteOnePrefetch| calls that has not finished yet. 90 // Number of in-flight |ExecuteOnePrefetch| calls that has not finished yet.
89 int number_of_inflight_prefetches_; 91 int number_of_inflight_prefetches_;
90 92
91 // Number of in-flight |VisitDirectory| calls that has not finished yet. 93 // Number of in-flight |VisitDirectory| calls that has not finished yet.
92 int number_of_inflight_traversals_; 94 int number_of_inflight_traversals_;
(...skipping 14 matching lines...) Expand all
107 109
108 // Note: This should remain the last member so it'll be destroyed and 110 // Note: This should remain the last member so it'll be destroyed and
109 // invalidate its weak pointers before any other members are destroyed. 111 // invalidate its weak pointers before any other members are destroyed.
110 base::WeakPtrFactory<DrivePrefetcher> weak_ptr_factory_; 112 base::WeakPtrFactory<DrivePrefetcher> weak_ptr_factory_;
111 DISALLOW_COPY_AND_ASSIGN(DrivePrefetcher); 113 DISALLOW_COPY_AND_ASSIGN(DrivePrefetcher);
112 }; 114 };
113 115
114 } // namespace drive 116 } // namespace drive
115 117
116 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_ 118 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/drive_prefetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698