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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/search_operation.h

Issue 150113002: drive: Also lock SearchOperation when locking ChangeListLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_FILE_SYSTEM_SEARCH_OPERATION_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/chromeos/drive/file_errors.h" 12 #include "chrome/browser/chromeos/drive/file_errors.h"
13 #include "chrome/browser/chromeos/drive/file_system_interface.h" 13 #include "chrome/browser/chromeos/drive/file_system_interface.h"
14 #include "google_apis/drive/gdata_errorcode.h" 14 #include "google_apis/drive/gdata_errorcode.h"
15 15
16 namespace base { 16 namespace base {
17 class SequencedTaskRunner; 17 class SequencedTaskRunner;
18 } // namespace base 18 } // namespace base
19 19
20 namespace google_apis { 20 namespace google_apis {
21 class ResourceEntry; 21 class ResourceEntry;
22 class ResourceList; 22 class ResourceList;
23 } // namespace google_apis 23 } // namespace google_apis
24 24
25 namespace drive { 25 namespace drive {
26 26
27 class JobScheduler; 27 class JobScheduler;
28 28
29 namespace internal { 29 namespace internal {
30 class LoaderController;
30 class ResourceMetadata; 31 class ResourceMetadata;
31 } // namespace internal 32 } // namespace internal
32 33
33 namespace file_system { 34 namespace file_system {
34 35
35 // This class encapsulates the drive Search function. It is responsible for 36 // This class encapsulates the drive Search function. It is responsible for
36 // sending the request to the drive API. 37 // sending the request to the drive API.
37 class SearchOperation { 38 class SearchOperation {
38 public: 39 public:
39 SearchOperation(base::SequencedTaskRunner* blocking_task_runner, 40 SearchOperation(base::SequencedTaskRunner* blocking_task_runner,
40 JobScheduler* scheduler, 41 JobScheduler* scheduler,
41 internal::ResourceMetadata* metadata); 42 internal::ResourceMetadata* metadata,
43 internal::LoaderController* loader_controller);
42 ~SearchOperation(); 44 ~SearchOperation();
43 45
44 // Performs server side content search operation for |search_query|. If 46 // Performs server side content search operation for |search_query|. If
45 // |next_link| is set, this is the search result url that will be fetched. 47 // |next_link| is set, this is the search result url that will be fetched.
46 // Upon completion, |callback| will be called with the result. This is 48 // Upon completion, |callback| will be called with the result. This is
47 // implementation of FileSystemInterface::Search() method. 49 // implementation of FileSystemInterface::Search() method.
48 // 50 //
49 // |callback| must not be null. 51 // |callback| must not be null.
50 void Search(const std::string& search_query, 52 void Search(const std::string& search_query,
51 const GURL& next_link, 53 const GURL& next_link,
52 const SearchCallback& callback); 54 const SearchCallback& callback);
53 55
54 private: 56 private:
55 // Part of Search(), called after the ResourceList is fetched from the server. 57 // Part of Search(), called after the ResourceList is fetched from the server.
56 void SearchAfterGetResourceList( 58 void SearchAfterGetResourceList(
57 const SearchCallback& callback, 59 const SearchCallback& callback,
58 google_apis::GDataErrorCode gdata_error, 60 google_apis::GDataErrorCode gdata_error,
59 scoped_ptr<google_apis::ResourceList> resource_list); 61 scoped_ptr<google_apis::ResourceList> resource_list);
60 62
61 // Part of Search(), called after |result| is filled on the blocking pool. 63 // Part of Search(), called after |result| is filled on the blocking pool.
62 void SearchAfterResolveSearchResult( 64 void SearchAfterResolveSearchResult(
63 const SearchCallback& callback, 65 const SearchCallback& callback,
64 const GURL& next_link, 66 const GURL& next_link,
65 scoped_ptr<std::vector<SearchResultInfo> > result, 67 scoped_ptr<std::vector<SearchResultInfo> > result,
66 FileError error); 68 FileError error);
67 69
68 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 70 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
69 JobScheduler* scheduler_; 71 JobScheduler* scheduler_;
70 internal::ResourceMetadata* metadata_; 72 internal::ResourceMetadata* metadata_;
73 internal::LoaderController* loader_controller_;
71 74
72 // Note: This should remain the last member so it'll be destroyed and 75 // Note: This should remain the last member so it'll be destroyed and
73 // invalidate the weak pointers before any other members are destroyed. 76 // invalidate the weak pointers before any other members are destroyed.
74 base::WeakPtrFactory<SearchOperation> weak_ptr_factory_; 77 base::WeakPtrFactory<SearchOperation> weak_ptr_factory_;
75 DISALLOW_COPY_AND_ASSIGN(SearchOperation); 78 DISALLOW_COPY_AND_ASSIGN(SearchOperation);
76 }; 79 };
77 80
78 } // namespace file_system 81 } // namespace file_system
79 } // namespace drive 82 } // namespace drive
80 83
81 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_ 84 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SEARCH_OPERATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698