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

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

Issue 9877006: gdata: Fix a bug that blocked FILE thread when loading large feeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_system_unittest.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/gdata/gdata_file_system.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/eintr_wrapper.h" 12 #include "base/eintr_wrapper.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/json/json_file_value_serializer.h" 14 #include "base/json/json_file_value_serializer.h"
15 #include "base/json/json_reader.h" 15 #include "base/json/json_reader.h"
16 #include "base/json/json_writer.h" 16 #include "base/json/json_writer.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/message_loop_proxy.h" 18 #include "base/message_loop_proxy.h"
19 #include "base/platform_file.h" 19 #include "base/platform_file.h"
20 #include "base/threading/platform_thread.h" 20 #include "base/threading/platform_thread.h"
21 #include "base/threading/sequenced_worker_pool.h"
21 #include "base/synchronization/waitable_event.h" 22 #include "base/synchronization/waitable_event.h"
22 #include "base/values.h" 23 #include "base/values.h"
23 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" 24 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h"
24 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" 25 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
25 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" 26 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h"
26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 27 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
27 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" 28 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h"
28 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/common/chrome_constants.h" 30 #include "chrome/common/chrome_constants.h"
30 #include "chrome/common/chrome_paths_internal.h" 31 #include "chrome/common/chrome_paths_internal.h"
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 } 1822 }
1822 1823
1823 void GDataFileSystem::LoadRootFeedFromCache( 1824 void GDataFileSystem::LoadRootFeedFromCache(
1824 const FilePath& search_file_path, 1825 const FilePath& search_file_path,
1825 bool should_load_from_server, 1826 bool should_load_from_server,
1826 const FindFileCallback& callback) { 1827 const FindFileCallback& callback) {
1827 base::PlatformFileError* error = 1828 base::PlatformFileError* error =
1828 new base::PlatformFileError(base::PLATFORM_FILE_OK); 1829 new base::PlatformFileError(base::PLATFORM_FILE_OK);
1829 base::ListValue* feed_list = new base::ListValue; 1830 base::ListValue* feed_list = new base::ListValue;
1830 1831
1831 PostBlockingPoolSequencedTaskAndReply( 1832 // Post a task without the sequence token, as this doesn't have to be
1832 kGDataFileSystemToken, 1833 // sequenced with other tasks, and can take long if the feed is large.
1834 // Note that it's OK to do this before the cache is initialized.
1835 BrowserThread::GetBlockingPool()->PostTaskAndReply(
1833 FROM_HERE, 1836 FROM_HERE,
1834 base::Bind(&GDataFileSystem::LoadRootFeedOnIOThreadPool, 1837 base::Bind(&GDataFileSystem::LoadRootFeedOnIOThreadPool,
1835 cache_paths_[GDataRootDirectory::CACHE_TYPE_META].Append( 1838 cache_paths_[GDataRootDirectory::CACHE_TYPE_META].Append(
1836 kLastFeedFile), 1839 kLastFeedFile),
1837 error, 1840 error,
1838 feed_list), 1841 feed_list),
1839 base::Bind(&GDataFileSystem::OnLoadRootFeed, 1842 base::Bind(&GDataFileSystem::OnLoadRootFeed,
1840 GetWeakPtrForCurrentThread(), 1843 GetWeakPtrForCurrentThread(),
1841 search_file_path, 1844 search_file_path,
1842 should_load_from_server, 1845 should_load_from_server,
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
3630 BrowserThread::FILE, 3633 BrowserThread::FILE,
3631 from_here, 3634 from_here,
3632 base::Bind(&GDataFileSystem::RunTaskOnIOThreadPool, 3635 base::Bind(&GDataFileSystem::RunTaskOnIOThreadPool,
3633 base::Unretained(this), 3636 base::Unretained(this),
3634 request_task), 3637 request_task),
3635 reply_task); 3638 reply_task);
3636 DCHECK(posted); 3639 DCHECK(posted);
3637 } 3640 }
3638 3641
3639 } // namespace gdata 3642 } // namespace gdata
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698