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

Side by Side Diff: chrome/browser/browsing_data_helper_browsertest.h

Issue 6246105: Only invoke WebKit methods in browsing data helpers on the WEBKIT thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Contains code shared by all browsing data browsertests.
6
7 #ifndef CHROME_BROWSER_BROWSING_DATA_HELPER_BROWSERTEST_H_
8 #define CHROME_BROWSER_BROWSING_DATA_HELPER_BROWSERTEST_H_
9 #pragma once
10
11 #include <vector>
12
13 #include "base/basictypes.h"
14 #include "base/logging.h"
15 #include "base/message_loop.h"
16
17 // This template can be used for the StartFetching methods of the browsing data
18 // helper classes. It is supposed to be instantiated with the respective
19 // browsing data info type.
20 template <typename T>
21 class BrowsingDataHelperCallback {
22 public:
23 BrowsingDataHelperCallback()
24 : has_result_(false) {
25 }
26
27 const std::vector<T>& result() {
28 MessageLoop::current()->Run();
29 DCHECK(has_result_);
30 return result_;
31 }
32
33 void callback(const std::vector<T>& info) {
34 result_ = info;
35 has_result_ = true;
36 MessageLoop::current()->Quit();
37 }
38
39 private:
40 bool has_result_;
41 std::vector<T> result_;
42
43 DISALLOW_COPY_AND_ASSIGN(BrowsingDataHelperCallback);
44 };
45
46 #endif // CHROME_BROWSER_BROWSING_DATA_HELPER_BROWSERTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698