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

Side by Side Diff: chrome/browser/chromeos/drive/drive_test_util.h

Issue 12706012: chromeos: Destruct DriveResourceMetadata on the blocking pool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 7 years, 9 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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" 9 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h"
10 #include "chrome/browser/chromeos/drive/search_metadata.h" 10 #include "chrome/browser/chromeos/drive/search_metadata.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void CopyResultsFromCloseFileCallbackAndQuit(DriveFileError* out_error, 162 void CopyResultsFromCloseFileCallbackAndQuit(DriveFileError* out_error,
163 DriveFileError error); 163 DriveFileError error);
164 164
165 // Loads a test json file as root ("/drive") element from a test file stored 165 // Loads a test json file as root ("/drive") element from a test file stored
166 // under chrome/test/data/chromeos. Returns true on success. 166 // under chrome/test/data/chromeos. Returns true on success.
167 bool LoadChangeFeed(const std::string& relative_path, 167 bool LoadChangeFeed(const std::string& relative_path,
168 ChangeListLoader* change_list_loader, 168 ChangeListLoader* change_list_loader,
169 bool is_delta_feed, 169 bool is_delta_feed,
170 int64 root_feed_changestamp); 170 int64 root_feed_changestamp);
171 171
172 // DriveCache has private destructor, so it is impossible to delete the 172 // Helper to destroy objects which needs Destroy() to be called on destruction.
hidehiko 2013/03/18 13:16:28 How about adding comment that it is necessary to i
hashimoto 2013/03/18 13:40:10 It's not necessary as long as the blocking task ru
hidehiko 2013/03/18 13:57:44 I understand. Could you add short comment about it
hashimoto 2013/03/18 15:15:34 Added a note.
173 // instance directly. This method delete it correctly. 173 template<typename T>
174 void DeleteDriveCache(DriveCache* drive_cache); 174 struct DestroyHelperForTests {
hidehiko 2013/03/18 13:16:28 ditto.
hashimoto 2013/03/18 13:40:10 Done.
175 // scoped_ptr for T which calls Destroy() and RunBlockingPoolTask() on
176 // destruction.
177 typedef scoped_ptr<T, DestroyHelperForTests<T> > scoped_ptr;
178
179 void operator()(T* object) const {
180 if (object)
181 object->Destroy();
182 google_apis::test_util::RunBlockingPoolTask(); // Finish destruction.
183 }
184 };
175 185
176 } // namespace test_util 186 } // namespace test_util
177 } // namespace drive 187 } // namespace drive
178 188
179 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ 189 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698