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

Side by Side Diff: chrome/browser/chromeos/drive/change_list_loader.cc

Issue 23958006: Use "Files: list" for full fetch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/drive/drive_api_service.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 #include "chrome/browser/chromeos/drive/change_list_loader.h" 5 #include "chrome/browser/chromeos/drive/change_list_loader.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 virtual void Run(const FeedFetcherCallback& callback) OVERRIDE { 52 virtual void Run(const FeedFetcherCallback& callback) OVERRIDE {
53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
54 DCHECK(!callback.is_null()); 54 DCHECK(!callback.is_null());
55 55
56 // Rememeber the time stamp for usage stats. 56 // Rememeber the time stamp for usage stats.
57 start_time_ = base::TimeTicks::Now(); 57 start_time_ = base::TimeTicks::Now();
58 58
59 // This is full resource list fetch. 59 // This is full resource list fetch.
60 scheduler_->GetAllResourceList( 60 scheduler_->GetAllResourceList(
61 base::Bind(&FullFeedFetcher::OnChangeListFetched, 61 base::Bind(&FullFeedFetcher::OnFileListFetched,
62 weak_ptr_factory_.GetWeakPtr(), callback)); 62 weak_ptr_factory_.GetWeakPtr(), callback));
63 } 63 }
64 64
65 private: 65 private:
66 void OnChangeListFetched( 66 void OnFileListFetched(
67 const FeedFetcherCallback& callback, 67 const FeedFetcherCallback& callback,
68 google_apis::GDataErrorCode status, 68 google_apis::GDataErrorCode status,
69 scoped_ptr<google_apis::ResourceList> resource_list) { 69 scoped_ptr<google_apis::ResourceList> resource_list) {
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
71 DCHECK(!callback.is_null()); 71 DCHECK(!callback.is_null());
72 72
73 // Looks the UMA stats we take here is useless as many methods use this 73 // Looks the UMA stats we take here is useless as many methods use this
74 // callback. crbug.com/229407 74 // callback. crbug.com/229407
75 if (change_lists_.empty()) { 75 if (change_lists_.empty()) {
76 UMA_HISTOGRAM_TIMES("Drive.InitialFeedLoadTime", 76 UMA_HISTOGRAM_TIMES("Drive.InitialFeedLoadTime",
77 base::TimeTicks::Now() - start_time_); 77 base::TimeTicks::Now() - start_time_);
78 } 78 }
79 79
80 FileError error = GDataToFileError(status); 80 FileError error = GDataToFileError(status);
81 if (error != FILE_ERROR_OK) { 81 if (error != FILE_ERROR_OK) {
82 callback.Run(error, ScopedVector<ChangeList>()); 82 callback.Run(error, ScopedVector<ChangeList>());
83 return; 83 return;
84 } 84 }
85 85
86 DCHECK(resource_list); 86 DCHECK(resource_list);
87 change_lists_.push_back(new ChangeList(*resource_list)); 87 change_lists_.push_back(new ChangeList(*resource_list));
88 88
89 GURL next_url; 89 GURL next_url;
90 if (resource_list->GetNextFeedURL(&next_url) && !next_url.is_empty()) { 90 if (resource_list->GetNextFeedURL(&next_url) && !next_url.is_empty()) {
91 // There is the remaining result so fetch it. 91 // There is the remaining result so fetch it.
92 scheduler_->GetRemainingChangeList( 92 scheduler_->GetRemainingFileList(
93 next_url, 93 next_url,
94 base::Bind(&FullFeedFetcher::OnChangeListFetched, 94 base::Bind(&FullFeedFetcher::OnFileListFetched,
95 weak_ptr_factory_.GetWeakPtr(), callback)); 95 weak_ptr_factory_.GetWeakPtr(), callback));
96 return; 96 return;
97 } 97 }
98 98
99 // This UMA stats looks also different from what we want. crbug.com/229407 99 // This UMA stats looks also different from what we want. crbug.com/229407
100 UMA_HISTOGRAM_TIMES("Drive.EntireFeedLoadTime", 100 UMA_HISTOGRAM_TIMES("Drive.EntireFeedLoadTime",
101 base::TimeTicks::Now() - start_time_); 101 base::TimeTicks::Now() - start_time_);
102 102
103 // Note: The fetcher is managed by ChangeListLoader, and the instance 103 // Note: The fetcher is managed by ChangeListLoader, and the instance
104 // will be deleted in the callback. Do not touch the fields after this 104 // will be deleted in the callback. Do not touch the fields after this
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_, 973 FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_,
974 OnDirectoryChanged(*dir_iter)); 974 OnDirectoryChanged(*dir_iter));
975 } 975 }
976 } 976 }
977 977
978 callback.Run(); 978 callback.Run();
979 } 979 }
980 980
981 } // namespace internal 981 } // namespace internal
982 } // namespace drive 982 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/drive/drive_api_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698