| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_PROXY_H_ | |
| 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_PROXY_H_ | |
| 7 | |
| 8 #include "base/base_export.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/single_thread_task_runner.h" | |
| 12 | |
| 13 // MessageLoopProxy is deprecated. Code should prefer to depend on TaskRunner | |
| 14 // (or the various specializations) for passing task runners around, and should | |
| 15 // use ThreadTaskRunnerHandle::Get() to get the thread's associated task runner. | |
| 16 // | |
| 17 // See http://crbug.com/391045 for more details. | |
| 18 // Example for these changes: | |
| 19 // | |
| 20 // base::MessageLoopProxy::current() -> base::ThreadTaskRunnerHandle::Get() | |
| 21 // scoped_refptr<base::MessageLoopProxy> -> | |
| 22 // scoped_refptr<base::SingleThreadTaskRunner> | |
| 23 // base::MessageLoopProxy -> base::SingleThreadTaskRunner | |
| 24 | |
| 25 namespace base { | |
| 26 | |
| 27 // This class provides a thread-safe refcounted interface to the Post* methods | |
| 28 // of a message loop. This class can outlive the target message loop. | |
| 29 // MessageLoopProxy objects are constructed automatically for all MessageLoops. | |
| 30 // So, to access them, you can use any of the following: | |
| 31 // Thread::message_loop_proxy() | |
| 32 // MessageLoop::current()->message_loop_proxy() | |
| 33 // MessageLoopProxy::current() | |
| 34 // | |
| 35 // TODO(akalin): Now that we have the *TaskRunner interfaces, we can | |
| 36 // merge this with MessageLoopProxyImpl. | |
| 37 class BASE_EXPORT MessageLoopProxy : public SingleThreadTaskRunner { | |
| 38 public: | |
| 39 // Gets the MessageLoopProxy for the current message loop, creating one if | |
| 40 // needed. | |
| 41 static scoped_refptr<MessageLoopProxy> current(); | |
| 42 | |
| 43 protected: | |
| 44 MessageLoopProxy(); | |
| 45 ~MessageLoopProxy() override; | |
| 46 }; | |
| 47 | |
| 48 } // namespace base | |
| 49 | |
| 50 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_PROXY_H_ | |
| OLD | NEW |