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

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

Issue 3131026: Moving file_system_proxy to base/ and changing it to work with MessageLoopPro... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « base/file_util_proxy.cc ('k') | chrome/browser/chrome_thread_relay.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 // ChromeThreadRelay provides a convenient way to bounce work to a specific
6 // ChromeThread and then return results back to the originating thread.
7 //
8 // EXAMPLE:
9 //
10 // class MyRelay : public ChromeThreadRelay {
11 // public:
12 // MyRelay(const Params& params) : params_(params) {
13 // }
14 // protected:
15 // virtual void RunWork() {
16 // results_ = DoWork(params_);
17 // }
18 // virtual void RunCallback() {
19 // ... use results_ on the originating thread ...
20 // }
21 // private:
22 // Params params_;
23 // Results_ results_;
24 // };
25
26 #ifndef CHROME_BROWSER_CHROME_THREAD_RELAY_H_
27 #define CHROME_BROWSER_CHROME_THREAD_RELAY_H_
28
29 #include "base/ref_counted.h"
30 #include "chrome/browser/chrome_thread.h"
31
32 class ChromeThreadRelay
33 : public base::RefCountedThreadSafe<ChromeThreadRelay> {
34 public:
35 ChromeThreadRelay();
36
37 void Start(ChromeThread::ID target_thread_id,
38 const tracked_objects::Location& from_here);
39
40 protected:
41 friend class base::RefCountedThreadSafe<ChromeThreadRelay>;
42 virtual ~ChromeThreadRelay() {}
43
44 // Called to perform work on the FILE thread.
45 virtual void RunWork() = 0;
46
47 // Called to notify the callback on the origin thread.
48 virtual void RunCallback() = 0;
49
50 private:
51 void ProcessOnTargetThread();
52 ChromeThread::ID origin_thread_id_;
53 };
54
55 #endif // CHROME_BROWSER_CHROME_THREAD_RELAY_H_
OLDNEW
« no previous file with comments | « base/file_util_proxy.cc ('k') | chrome/browser/chrome_thread_relay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698