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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/drive/drive_test_util.h
diff --git a/chrome/browser/chromeos/drive/drive_test_util.h b/chrome/browser/chromeos/drive/drive_test_util.h
index 03fb3d93124f67a5e37525b77f83e49dca814200..72b79b1935e48caf5f624a16cecd066edc5c13ff 100644
--- a/chrome/browser/chromeos/drive/drive_test_util.h
+++ b/chrome/browser/chromeos/drive/drive_test_util.h
@@ -169,9 +169,19 @@ bool LoadChangeFeed(const std::string& relative_path,
bool is_delta_feed,
int64 root_feed_changestamp);
-// DriveCache has private destructor, so it is impossible to delete the
-// instance directly. This method delete it correctly.
-void DeleteDriveCache(DriveCache* drive_cache);
+// 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.
+template<typename T>
+struct DestroyHelperForTests {
hidehiko 2013/03/18 13:16:28 ditto.
hashimoto 2013/03/18 13:40:10 Done.
+ // scoped_ptr for T which calls Destroy() and RunBlockingPoolTask() on
+ // destruction.
+ typedef scoped_ptr<T, DestroyHelperForTests<T> > scoped_ptr;
+
+ void operator()(T* object) const {
+ if (object)
+ object->Destroy();
+ google_apis::test_util::RunBlockingPoolTask(); // Finish destruction.
+ }
+};
} // namespace test_util
} // namespace drive

Powered by Google App Engine
This is Rietveld 408576698