summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/drive
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 07:11:02 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 07:11:02 +0000
commitb6585349d38ed596d3222a4a54d82c3c88b91e5e (patch)
tree5272ee573dfb267b71f002cd2872f1441a61b335 /chrome/browser/chromeos/drive
parent57fb5393bf051c590769c9b5723d5a9f4090a4cc (diff)
downloadchromium_src-b6585349d38ed596d3222a4a54d82c3c88b91e5e.zip
chromium_src-b6585349d38ed596d3222a4a54d82c3c88b91e5e.tar.gz
chromium_src-b6585349d38ed596d3222a4a54d82c3c88b91e5e.tar.bz2
Remove DrivePrefetcher and relevant flags.
The feature is not used now, and unlikely to added back any time soon. BUG=231206 Review URL: https://codereview.chromium.org/14093022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/drive')
-rw-r--r--chrome/browser/chromeos/drive/drive_file_system_interface.h1
-rw-r--r--chrome/browser/chromeos/drive/drive_prefetcher.cc193
-rw-r--r--chrome/browser/chromeos/drive/drive_prefetcher.h101
-rw-r--r--chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc228
-rw-r--r--chrome/browser/chromeos/drive/drive_system_service.cc3
-rw-r--r--chrome/browser/chromeos/drive/drive_system_service.h2
-rw-r--r--chrome/browser/chromeos/drive/job_scheduler.cc1
-rw-r--r--chrome/browser/chromeos/drive/job_scheduler_unittest.cc6
8 files changed, 3 insertions, 532 deletions
diff --git a/chrome/browser/chromeos/drive/drive_file_system_interface.h b/chrome/browser/chromeos/drive/drive_file_system_interface.h
index 2099688..078d77c 100644
--- a/chrome/browser/chromeos/drive/drive_file_system_interface.h
+++ b/chrome/browser/chromeos/drive/drive_file_system_interface.h
@@ -121,7 +121,6 @@ typedef base::Callback<void(const DriveFileSystemMetadata&)>
enum ContextType {
USER_INITIATED,
BACKGROUND,
- PREFETCH,
};
struct DriveClientContext {
diff --git a/chrome/browser/chromeos/drive/drive_prefetcher.cc b/chrome/browser/chromeos/drive/drive_prefetcher.cc
deleted file mode 100644
index a79dfaa..0000000
--- a/chrome/browser/chromeos/drive/drive_prefetcher.cc
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/drive/drive_prefetcher.h"
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/stringprintf.h"
-#include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
-#include "chrome/browser/chromeos/drive/file_system_util.h"
-#include "chrome/browser/chromeos/drive/logging.h"
-#include "chrome/common/chrome_switches.h"
-#include "content/public/browser/browser_thread.h"
-
-using content::BrowserThread;
-
-namespace drive {
-
-namespace {
-
-const int kInitialPrefetchCount = 100;
-const int64 kPrefetchFileSizeLimit = 10 << 20; // 10MB
-
-// Returns true if prefetching is enabled by a command line option.
-bool IsPrefetchEnabled() {
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableDrivePrefetch);
-}
-
-// Returns true if |left| has lower priority than |right|.
-bool ComparePrefetchPriority(const DriveEntryProto& left,
- const DriveEntryProto& right) {
- // First, compare last access time. The older entry has less priority.
- if (left.file_info().last_accessed() != right.file_info().last_accessed())
- return left.file_info().last_accessed() < right.file_info().last_accessed();
-
- // When the entries have the same last access time (which happens quite often
- // because Drive server doesn't set the field until an entry is viewed via
- // drive.google.com), we use last modified time as the tie breaker.
- if (left.file_info().last_modified() != right.file_info().last_modified())
- return left.file_info().last_modified() < right.file_info().last_modified();
-
- // Two entries have the same priority. To make this function a valid
- // comparator for std::set, we need to differentiate them anyhow.
- return left.resource_id() < right.resource_id();
-}
-
-}
-
-DrivePrefetcherOptions::DrivePrefetcherOptions()
- : initial_prefetch_count(kInitialPrefetchCount),
- prefetch_file_size_limit(kPrefetchFileSizeLimit) {
-}
-
-DrivePrefetcher::DrivePrefetcher(DriveFileSystemInterface* file_system,
- const DrivePrefetcherOptions& options)
- : latest_files_(&ComparePrefetchPriority),
- number_of_inflight_traversals_(0),
- initial_prefetch_count_(options.initial_prefetch_count),
- prefetch_file_size_limit_(options.prefetch_file_size_limit),
- file_system_(file_system),
- weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- // The flag controls whether or not the prefetch observe the file system. When
- // it is disabled, no event (except the direct call of OnInitialLoadFinished
- // in the unit test code) will trigger the prefetcher.
- if (IsPrefetchEnabled())
- file_system_->AddObserver(this);
-}
-
-DrivePrefetcher::~DrivePrefetcher() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (IsPrefetchEnabled())
- file_system_->RemoveObserver(this);
-}
-
-void DrivePrefetcher::OnInitialLoadFinished() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- StartPrefetcherCycle();
-}
-
-void DrivePrefetcher::OnDirectoryChanged(const base::FilePath& directory_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- // TODO(kinaba): crbug.com/156270.
- // Update the list of latest files and the prefetch queue if needed.
-}
-
-void DrivePrefetcher::StartPrefetcherCycle() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- // Scans the filesystem. When it is finished, DoPrefetch() will be called.
- VisitDirectory(util::GetDriveMyDriveRootPath());
-}
-
-void DrivePrefetcher::DoPrefetch() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- for (LatestFileSet::reverse_iterator it = latest_files_.rbegin();
- it != latest_files_.rend(); ++it) {
- const std::string& resource_id = it->resource_id();
- util::Log("Prefetcher: Enqueue prefetching %s", resource_id.c_str());
- file_system_->GetFileByResourceId(
- resource_id,
- DriveClientContext(PREFETCH),
- base::Bind(&DrivePrefetcher::OnPrefetchFinished,
- weak_ptr_factory_.GetWeakPtr(),
- resource_id),
- google_apis::GetContentCallback());
- }
-}
-
-void DrivePrefetcher::OnPrefetchFinished(const std::string& resource_id,
- FileError error,
- const base::FilePath& file_path,
- const std::string& mime_type,
- DriveFileType file_type) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (error != FILE_ERROR_OK)
- LOG(WARNING) << "Prefetch failed: " << FileErrorToString(error);
- util::Log("Prefetcher: Finish fetching (%s) %s",
- FileErrorToString(error).c_str(),
- resource_id.c_str());
-}
-
-void DrivePrefetcher::VisitFile(const DriveEntryProto& entry) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- // Excessively large files will not be fetched.
- if (entry.file_info().size() > prefetch_file_size_limit_)
- return;
-
- // Remember the file in the set ordered by the |last_accessed| field.
- latest_files_.insert(entry);
- // If the set become too big, forget the oldest entry.
- if (latest_files_.size() > static_cast<size_t>(initial_prefetch_count_))
- latest_files_.erase(latest_files_.begin());
-}
-
-void DrivePrefetcher::VisitDirectory(const base::FilePath& directory_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- ++number_of_inflight_traversals_;
- file_system_->ReadDirectoryByPath(
- directory_path,
- base::Bind(&DrivePrefetcher::OnReadDirectory,
- weak_ptr_factory_.GetWeakPtr(),
- directory_path));
-}
-
-void DrivePrefetcher::OnReadDirectory(
- const base::FilePath& directory_path,
- FileError error,
- bool hide_hosted_documents,
- scoped_ptr<DriveEntryProtoVector> entries) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- if (error != FILE_ERROR_OK) {
- LOG(WARNING) << "Directory cannot be scanned by prefetcher: "
- << directory_path.value();
- OnReadDirectoryFinished();
- return;
- }
-
- // TODO(kinaba): if entries->size() is so big and it does not contain any
- // directories, the loop below may run on UI thread long time. Consider
- // splitting it into a smaller asynchronous tasks.
- for (size_t i = 0; i < entries->size(); ++i) {
- const DriveEntryProto& entry = (*entries)[i];
-
- if (entry.file_info().is_directory()) {
- VisitDirectory(directory_path.Append(entry.base_name()));
- } else if (entry.has_file_specific_info() &&
- !entry.file_specific_info().is_hosted_document()) {
- VisitFile(entry);
- }
- }
-
- OnReadDirectoryFinished();
-}
-
-void DrivePrefetcher::OnReadDirectoryFinished() {
- DCHECK(number_of_inflight_traversals_ > 0);
-
- --number_of_inflight_traversals_;
- if (number_of_inflight_traversals_ == 0)
- DoPrefetch(); // Start prefetching.
-}
-
-} // namespace drive
diff --git a/chrome/browser/chromeos/drive/drive_prefetcher.h b/chrome/browser/chromeos/drive/drive_prefetcher.h
deleted file mode 100644
index 7ca7021..0000000
--- a/chrome/browser/chromeos/drive/drive_prefetcher.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_
-#define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_
-
-#include <set>
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "chrome/browser/chromeos/drive/drive.pb.h"
-#include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
-#include "chrome/browser/chromeos/drive/file_system_observer.h"
-
-namespace base {
-class FilePath;
-}
-
-namespace drive {
-
-// The parameters for DrivePrefetcher construction.
-struct DrivePrefetcherOptions {
- DrivePrefetcherOptions(); // Sets the default values.
-
- int initial_prefetch_count;
- int64 prefetch_file_size_limit;
-};
-
-// DrivePrefetcher is used to observe and scan the Drive file system for
-// maintaining the prioritized list of files to prefetch into the cache.
-//
-// All the methods (including ctor and dtor) must be called from UI thread.
-class DrivePrefetcher : public FileSystemObserver {
- public:
- DrivePrefetcher(DriveFileSystemInterface* file_system,
- const DrivePrefetcherOptions& options);
- virtual ~DrivePrefetcher();
-
- // FileSystemObserver overrides.
- virtual void OnInitialLoadFinished() OVERRIDE;
- virtual void OnDirectoryChanged(
- const base::FilePath& directory_path) OVERRIDE;
-
- private:
- // Scans the file system and calls DoPrefetch().
- void StartPrefetcherCycle();
-
- // Fetches the file with the highest prefetch priority. If prefetching is
- // currently suspended, do nothing.
- void DoPrefetch();
-
- // Called when DoPrefetch is done.
- void OnPrefetchFinished(const std::string& resource_id,
- FileError error,
- const base::FilePath& file_path,
- const std::string& mime_type,
- DriveFileType file_type);
-
- // Creates the |queue_| from the list of files with |latest_| timestamps.
- void ReconstructQueue();
-
- // Helper methods to traverse over the file system.
- void VisitFile(const DriveEntryProto& entry);
- void VisitDirectory(const base::FilePath& directory_path);
- void OnReadDirectory(const base::FilePath& directory_path,
- FileError error,
- bool hide_hosted_documents,
- scoped_ptr<DriveEntryProtoVector> entries);
- void OnReadDirectoryFinished();
-
- // Keeps the kNumberOfLatestFilesToKeepInCache latest files in the filesystem.
- typedef bool (*PrefetchPriorityComparator)(const DriveEntryProto&,
- const DriveEntryProto&);
- typedef std::set<DriveEntryProto, PrefetchPriorityComparator> LatestFileSet;
- LatestFileSet latest_files_;
-
- // Number of in-flight |VisitDirectory| calls that has not finished yet.
- int number_of_inflight_traversals_;
-
- // Number of files to put into prefetch queue
- int initial_prefetch_count_;
-
- // The maximum file size for prefetched files. Files larger than the limit is
- // ignored from the prefetcher.
- int64 prefetch_file_size_limit_;
-
- // File system is owned by DriveSystemService.
- DriveFileSystemInterface* file_system_;
-
- // Note: This should remain the last member so it'll be destroyed and
- // invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<DrivePrefetcher> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(DrivePrefetcher);
-};
-
-} // namespace drive
-
-#endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PREFETCHER_H_
diff --git a/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc b/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc
deleted file mode 100644
index 98e2c81..0000000
--- a/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc
+++ /dev/null
@@ -1,228 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/drive/drive_prefetcher.h"
-
-#include <string>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/message_loop.h"
-#include "base/run_loop.h"
-#include "chrome/browser/chromeos/drive/drive.pb.h"
-#include "chrome/browser/chromeos/drive/mock_drive_file_system.h"
-#include "chrome/browser/chromeos/drive/test_util.h"
-#include "content/public/test/test_browser_thread.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using ::testing::AtMost;
-using ::testing::StrictMock;
-using ::testing::_;
-
-namespace drive {
-
-namespace {
-
-// Enumeration values to represent the type of drive entries.
-enum TestEntryType {
- TYPE_DIRECTORY,
- TYPE_REGULAR_FILE,
- TYPE_HOSTED_FILE,
-};
-
-// TestEntry represents a dummy entry for mocking a filesystem.
-struct TestEntry {
- const base::FilePath::CharType* path;
- TestEntryType entry_type;
- int64 last_accessed;
- int64 last_modified;
- const char* resource_id;
- int64 file_size;
-
- // Checks whether this TestEntry is the direct content of the |directory|.
- bool IsDirectChildOf(const base::FilePath& directory) const {
- return base::FilePath(path).DirName() == directory;
- }
-
- // Converts this TestEntry to DriveEntryProto, which is the real data
- // structure used in DriveFileSystem.
- DriveEntryProto ToDriveEntryProto() const {
- DriveEntryProto entry;
- entry.set_base_name(base::FilePath(path).BaseName().value());
- entry.mutable_file_info()->set_is_directory(entry_type == TYPE_DIRECTORY);
- if (entry_type != TYPE_DIRECTORY) {
- entry.mutable_file_specific_info()->set_is_hosted_document(
- entry_type == TYPE_HOSTED_FILE);
- entry.mutable_file_info()->set_size(file_size);
- }
- entry.mutable_file_info()->set_last_accessed(last_accessed);
- entry.mutable_file_info()->set_last_modified(last_modified);
- entry.set_resource_id(resource_id);
- return entry;
- }
-};
-
-// Mocks DriveFileSystem::GetFileByResourceId. It records the requested
-// resource_id (arg0) to |fetched_list|, and calls back a successful completion.
-ACTION_P(MockGetFile, fetched_list) {
- fetched_list->push_back(arg0);
- arg2.Run(FILE_ERROR_OK, base::FilePath(), std::string(), REGULAR_FILE);
-}
-
-// Mocks DriveFileSystem::ReadDirectory. It holds the flat list of all entries
-// in the mock filesystem in |test_entries|, and when it is called to read a
-// |directory|, it selects only the direct children of the directory.
-ACTION_P(MockReadDirectory, test_entries) {
- const base::FilePath& directory = arg0;
- const ReadDirectoryWithSettingCallback& callback = arg1;
-
- scoped_ptr<DriveEntryProtoVector> entries(new DriveEntryProtoVector);
- for (size_t i = 0; i < test_entries.size(); ++i) {
- if (test_entries[i].IsDirectChildOf(directory))
- entries->push_back(test_entries[i].ToDriveEntryProto());
- }
- callback.Run(FILE_ERROR_OK, false /* hide_hosted_document */, entries.Pass());
-}
-
-#define FPL FILE_PATH_LITERAL
-
-const TestEntry kEmptyDrive[] = {
- { FPL("drive/root"), TYPE_DIRECTORY, 0, 0, "id:drive" },
-};
-
-const TestEntry kOneFileDrive[] = {
- { FPL("drive/root"), TYPE_DIRECTORY, 0, 0, "id:drive" },
- { FPL("drive/root/abc.txt"), TYPE_REGULAR_FILE, 1, 0,
- "id:abc" },
-};
-
-const char* kExpectedOneFile[] = { "id:abc" };
-
-const TestEntry kComplexDrive[] = {
- // Path Type Access Modify ID
- { FPL("drive/root"), TYPE_DIRECTORY, 0, 0, "id:root" },
- { FPL("drive/root/a"), TYPE_DIRECTORY, 0, 0, "id:a" },
- { FPL("drive/root/a/foo.txt"), TYPE_REGULAR_FILE, 3, 2, "id:foo1" },
- { FPL("drive/root/a/b"), TYPE_DIRECTORY, 8, 0, "id:b" },
- { FPL("drive/root/a/bar.jpg"), TYPE_REGULAR_FILE, 5, 0, "id:bar1",
- 999 },
- { FPL("drive/root/a/b/x.gdoc"), TYPE_HOSTED_FILE, 7, 0, "id:new" },
- { FPL("drive/root/a/buz.zip"), TYPE_REGULAR_FILE, 4, 0, "id:buz1" },
- { FPL("drive/root/a/old.gdoc"), TYPE_HOSTED_FILE, 1, 0, "id:old" },
- { FPL("drive/root/c"), TYPE_DIRECTORY, 0, 0, "id:c" },
- { FPL("drive/root/c/foo.txt"), TYPE_REGULAR_FILE, 3, 1, "id:foo2" },
- { FPL("drive/root/c/buz.zip"), TYPE_REGULAR_FILE, 1, 0, "id:buz2" },
- { FPL("drive/root/bar.jpg"), TYPE_REGULAR_FILE, 6, 0, "id:bar2" },
-};
-
-#undef FPL
-
-const char* kTop3Files[] = {
- "id:bar2", // The file with the largest timestamp
- // "bar1" is the second latest, but its file size is over limit.
- "id:buz1", // The third latest file.
- "id:foo1" // 4th. Has same access time with id:foo2, so the one with the
- // newer modified time wins.
-};
-
-const char* kAllRegularFiles[] = {
- "id:bar2", "id:bar1", "id:buz1", "id:foo1", "id:foo2", "id:buz2",
-};
-
-} // namespace
-
-class DrivePrefetcherTest : public testing::Test {
- public:
- DrivePrefetcherTest()
- : ui_thread_(content::BrowserThread::UI, &message_loop_) {}
-
- virtual void SetUp() OVERRIDE {
- mock_file_system_.reset(new StrictMock<MockDriveFileSystem>);
- }
-
- virtual void TearDown() OVERRIDE {
- EXPECT_CALL(*mock_file_system_, RemoveObserver(_)).Times(AtMost(1));
- prefetcher_.reset();
- mock_file_system_.reset();
- }
-
- protected:
- // Sets a new prefetcher that fetches at most |prefetch_count| latest files.
- void InitPrefetcher(int prefetch_count, int64 size_limit) {
- EXPECT_CALL(*mock_file_system_, AddObserver(_)).Times(AtMost(1));
-
- DrivePrefetcherOptions options;
- options.initial_prefetch_count = prefetch_count;
- options.prefetch_file_size_limit = size_limit;
- prefetcher_.reset(new DrivePrefetcher(mock_file_system_.get(),
- options));
- }
-
- // Flushes all the pending tasks on the current thread.
- void RunMessageLoop() {
- base::RunLoop run_loop;
- run_loop.RunUntilIdle();
- }
-
- // Verifies that fully running the prefetching loop over |test_entries|
- // correctly fetches the |expected| files, in the given order.
- void VerifyFullScan(const std::vector<TestEntry>& test_entries,
- const std::vector<std::string>& expected) {
- std::vector<std::string> fetched_list;
- EXPECT_CALL(*mock_file_system_, ReadDirectoryByPath(_, _))
- .WillRepeatedly(MockReadDirectory(test_entries));
- EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _, _, _)).Times(0);
- EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _, _, _))
- .WillRepeatedly(MockGetFile(&fetched_list));
- prefetcher_->OnInitialLoadFinished();
- RunMessageLoop();
- EXPECT_EQ(expected, fetched_list);
- }
-
- scoped_ptr<StrictMock<MockDriveFileSystem> > mock_file_system_;
- scoped_ptr<DrivePrefetcher> prefetcher_;
- MessageLoopForUI message_loop_;
- content::TestBrowserThread ui_thread_;
-};
-
-TEST_F(DrivePrefetcherTest, ZeroFiles) {
- InitPrefetcher(3, 100);
- VerifyFullScan(
- std::vector<TestEntry>(kEmptyDrive,
- kEmptyDrive + arraysize(kEmptyDrive)),
- std::vector<std::string>());
-}
-
-TEST_F(DrivePrefetcherTest, OneFile) {
- InitPrefetcher(3, 100);
- VerifyFullScan(
- std::vector<TestEntry>(kOneFileDrive,
- kOneFileDrive + arraysize(kOneFileDrive)),
- std::vector<std::string>(kExpectedOneFile,
- kExpectedOneFile + arraysize(kExpectedOneFile)));
-}
-
-TEST_F(DrivePrefetcherTest, MoreThanLimitFiles) {
- // Files with the largest timestamps should be listed, in the order of time.
- // Directories nor hosted files should not be listed.
- InitPrefetcher(3, 100);
- VerifyFullScan(
- std::vector<TestEntry>(kComplexDrive,
- kComplexDrive + arraysize(kComplexDrive)),
- std::vector<std::string>(kTop3Files, kTop3Files + arraysize(kTop3Files)));
-}
-
-TEST_F(DrivePrefetcherTest, DirectoryTraversal) {
- // Ensure the prefetcher correctly traverses whole the file system tree.
- // This is checked by setting the fetch limit larger than the number of files.
- InitPrefetcher(100, 99999999);
- VerifyFullScan(
- std::vector<TestEntry>(kComplexDrive,
- kComplexDrive + arraysize(kComplexDrive)),
- std::vector<std::string>(kAllRegularFiles,
- kAllRegularFiles + arraysize(kAllRegularFiles)));
-}
-
-} // namespace drive
diff --git a/chrome/browser/chromeos/drive/drive_system_service.cc b/chrome/browser/chromeos/drive/drive_system_service.cc
index fc83aca..d0920cb 100644
--- a/chrome/browser/chromeos/drive/drive_system_service.cc
+++ b/chrome/browser/chromeos/drive/drive_system_service.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/chromeos/drive/download_handler.h"
#include "chrome/browser/chromeos/drive/drive_cache.h"
#include "chrome/browser/chromeos/drive/drive_file_system.h"
-#include "chrome/browser/chromeos/drive/drive_prefetcher.h"
#include "chrome/browser/chromeos/drive/drive_webapps_registry.h"
#include "chrome/browser/chromeos/drive/file_system_proxy.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
@@ -149,8 +148,6 @@ DriveSystemService::DriveSystemService(
download_handler_.reset(new DownloadHandler(file_write_helper(),
file_system()));
sync_client_.reset(new SyncClient(file_system(), cache()));
- prefetcher_.reset(new DrivePrefetcher(file_system(),
- DrivePrefetcherOptions()));
stale_cache_files_remover_.reset(new StaleCacheFilesRemover(file_system(),
cache()));
}
diff --git a/chrome/browser/chromeos/drive/drive_system_service.h b/chrome/browser/chromeos/drive/drive_system_service.h
index 5c8d56a..0d33900 100644
--- a/chrome/browser/chromeos/drive/drive_system_service.h
+++ b/chrome/browser/chromeos/drive/drive_system_service.h
@@ -33,7 +33,6 @@ namespace drive {
class DownloadHandler;
class DriveCache;
class DriveFileSystemInterface;
-class DrivePrefetcher;
class DriveResourceMetadata;
class DriveWebAppsRegistry;
class FileSystemProxy;
@@ -162,7 +161,6 @@ class DriveSystemService
scoped_ptr<FileWriteHelper> file_write_helper_;
scoped_ptr<DownloadHandler> download_handler_;
scoped_ptr<SyncClient> sync_client_;
- scoped_ptr<DrivePrefetcher> prefetcher_;
scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_;
scoped_refptr<FileSystemProxy> file_system_proxy_;
diff --git a/chrome/browser/chromeos/drive/job_scheduler.cc b/chrome/browser/chromeos/drive/job_scheduler.cc
index c2152ef..8908693 100644
--- a/chrome/browser/chromeos/drive/job_scheduler.cc
+++ b/chrome/browser/chromeos/drive/job_scheduler.cc
@@ -658,7 +658,6 @@ bool JobScheduler::ShouldStopJobLoop(QueueType queue_type,
should_stop_on_cellular_network = false;
break;
case BACKGROUND:
- case PREFETCH:
should_stop_on_cellular_network = (queue_type == FILE_QUEUE);
break;
}
diff --git a/chrome/browser/chromeos/drive/job_scheduler_unittest.cc b/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
index 4377c8c..4dd112a 100644
--- a/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
+++ b/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
@@ -444,7 +444,7 @@ TEST_F(JobSchedulerTest, GetResourceEntryPriority) {
resource_1));
scheduler_->GetResourceEntry(
resource_2, // resource ID
- DriveClientContext(PREFETCH),
+ DriveClientContext(BACKGROUND),
base::Bind(&CopyResourceIdFromGetResourceEntryCallback,
&resource_ids,
resource_2));
@@ -468,8 +468,8 @@ TEST_F(JobSchedulerTest, GetResourceEntryPriority) {
ASSERT_EQ(resource_ids.size(), 4ul);
ASSERT_EQ(resource_ids[0], resource_1);
ASSERT_EQ(resource_ids[1], resource_4);
- ASSERT_EQ(resource_ids[2], resource_3);
- ASSERT_EQ(resource_ids[3], resource_2);
+ ASSERT_EQ(resource_ids[2], resource_2);
+ ASSERT_EQ(resource_ids[3], resource_3);
}
TEST_F(JobSchedulerTest, GetResourceEntryNoConnection) {