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

Side by Side Diff: base/message_loop_proxy_impl.h

Issue 1837003: Created a stock implementation of the MessageLoopProxy interface than can be ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Rearranged header files Created 10 years, 7 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/message_loop_proxy.h ('k') | base/message_loop_proxy_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
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 #ifndef BASE_MESSAGE_LOOP_PROXY_IMPL_H_
6 #define BASE_MESSAGE_LOOP_PROXY_IMPL_H_
7
8 #include "base/lock.h"
9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h"
11
12 namespace base {
13
14 // A stock implementation of MessageLoopProxy that takes in a MessageLoop
15 // and keeps track of its lifetime using the MessageLoop DestructionObserver.
16 // For now a MessageLoopProxyImpl can only be created for the current thread.
17 class MessageLoopProxyImpl : public MessageLoopProxy,
18 public MessageLoop::DestructionObserver {
19 public:
20 ~MessageLoopProxyImpl();
21
22 // MessageLoopProxy implementation
23 virtual bool PostTask(const tracked_objects::Location& from_here,
24 Task* task);
25 virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
26 Task* task, int64 delay_ms);
27 virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
28 Task* task);
29 virtual bool PostNonNestableDelayedTask(
30 const tracked_objects::Location& from_here,
31 Task* task,
32 int64 delay_ms);
33 virtual bool BelongsToCurrentThread();
34
35 // MessageLoop::DestructionObserver implementation
36 void WillDestroyCurrentMessageLoop();
37
38 protected:
39 // Override OnDestruct so that we can delete the object on the target message
40 // loop if it still exists.
41 virtual void OnDestruct();
42
43 private:
44 MessageLoopProxyImpl();
45 bool PostTaskHelper(const tracked_objects::Location& from_here,
46 Task* task, int64 delay_ms, bool nestable);
47
48 // For the factory method to work
49 friend class MessageLoopProxy;
50
51 // The lock that protects access to target_message_loop_.
52 Lock message_loop_lock_;
53 MessageLoop* target_message_loop_;
54
55 DISALLOW_COPY_AND_ASSIGN(MessageLoopProxyImpl);
56 };
57
58 } // namespace base
59
60 #endif // BASE_MESSAGE_LOOP_PROXY_IMPL_H_
61
OLDNEW
« no previous file with comments | « base/message_loop_proxy.h ('k') | base/message_loop_proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698