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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 10832241: Drive: Removes unused cache files after the initial feed fetch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the memory leak. 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 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/json/json_file_value_serializer.h" 12 #include "base/json/json_file_value_serializer.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/message_loop_proxy.h" 14 #include "base/message_loop_proxy.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/platform_file.h" 16 #include "base/platform_file.h"
17 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/chromeos/gdata/documents_service_interface.h" 19 #include "chrome/browser/chromeos/gdata/documents_service_interface.h"
20 #include "chrome/browser/chromeos/gdata/drive_api_parser.h" 20 #include "chrome/browser/chromeos/gdata/drive_api_parser.h"
21 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" 21 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h"
22 #include "chrome/browser/chromeos/gdata/gdata.pb.h" 22 #include "chrome/browser/chromeos/gdata/gdata.pb.h"
23 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" 23 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
24 #include "chrome/browser/chromeos/gdata/gdata_files.h" 24 #include "chrome/browser/chromeos/gdata/gdata_files.h"
25 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h" 25 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h"
26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
27 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" 27 #include "chrome/browser/chromeos/gdata/gdata_uploader.h"
28 #include "chrome/browser/chromeos/gdata/gdata_util.h" 28 #include "chrome/browser/chromeos/gdata/gdata_util.h"
29 #include "chrome/browser/chromeos/gdata/stale_cache_files_remover.h"
29 #include "chrome/browser/chromeos/gdata/task_util.h" 30 #include "chrome/browser/chromeos/gdata/task_util.h"
30 #include "chrome/browser/prefs/pref_service.h" 31 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/common/chrome_notification_types.h" 33 #include "chrome/common/chrome_notification_types.h"
33 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
34 #include "content/public/browser/browser_thread.h" 35 #include "content/public/browser/browser_thread.h"
35 #include "content/public/browser/notification_details.h" 36 #include "content/public/browser/notification_details.h"
36 #include "net/base/mime_util.h" 37 #include "net/base/mime_util.h"
37 38
38 using content::BrowserThread; 39 using content::BrowserThread;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 438
438 documents_service_->Initialize(profile_); 439 documents_service_->Initialize(profile_);
439 440
440 directory_service_.reset(new GDataDirectoryService); 441 directory_service_.reset(new GDataDirectoryService);
441 feed_loader_.reset(new GDataWapiFeedLoader(directory_service_.get(), 442 feed_loader_.reset(new GDataWapiFeedLoader(directory_service_.get(),
442 documents_service_, 443 documents_service_,
443 webapps_registry_, 444 webapps_registry_,
444 cache_, 445 cache_,
445 blocking_task_runner_)); 446 blocking_task_runner_));
446 feed_loader_->AddObserver(this); 447 feed_loader_->AddObserver(this);
448 stale_cache_files_remover_.reset(new StaleCacheFilesRemover(this, cache_));
447 449
448 PrefService* pref_service = profile_->GetPrefs(); 450 PrefService* pref_service = profile_->GetPrefs();
449 hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableGDataHostedFiles); 451 hide_hosted_docs_ = pref_service->GetBoolean(prefs::kDisableGDataHostedFiles);
450 452
451 InitializePreferenceObserver(); 453 InitializePreferenceObserver();
452 } 454 }
453 455
454 void GDataFileSystem::CheckForUpdates() { 456 void GDataFileSystem::CheckForUpdates() {
455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 457 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
456 ContentOrigin initial_origin = directory_service_->origin(); 458 ContentOrigin initial_origin = directory_service_->origin();
(...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 return; 3305 return;
3304 } 3306 }
3305 3307
3306 PlatformFileInfoProto entry_file_info; 3308 PlatformFileInfoProto entry_file_info;
3307 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); 3309 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info);
3308 *entry_proto->mutable_file_info() = entry_file_info; 3310 *entry_proto->mutable_file_info() = entry_file_info;
3309 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); 3311 callback.Run(GDATA_FILE_OK, entry_proto.Pass());
3310 } 3312 }
3311 3313
3312 } // namespace gdata 3314 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698