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

Side by Side Diff: base/message_loop/message_loop.h

Issue 1180153002: base: Remove MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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
« no previous file with comments | « base/base.gypi ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
11 #include "base/base_export.h" 11 #include "base/base_export.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/debug/task_annotator.h" 14 #include "base/debug/task_annotator.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/message_loop/incoming_task_queue.h" 18 #include "base/message_loop/incoming_task_queue.h"
19 #include "base/message_loop/message_loop_proxy.h" 19 #include "base/message_loop/message_loop_task_runner.h"
20 #include "base/message_loop/message_loop_proxy_impl.h"
21 #include "base/message_loop/message_pump.h" 20 #include "base/message_loop/message_pump.h"
22 #include "base/message_loop/timer_slack.h" 21 #include "base/message_loop/timer_slack.h"
23 #include "base/observer_list.h" 22 #include "base/observer_list.h"
24 #include "base/pending_task.h" 23 #include "base/pending_task.h"
25 #include "base/sequenced_task_runner_helpers.h" 24 #include "base/sequenced_task_runner_helpers.h"
26 #include "base/synchronization/lock.h" 25 #include "base/synchronization/lock.h"
27 #include "base/time/time.h" 26 #include "base/time/time.h"
28 #include "base/tracking_info.h" 27 #include "base/tracking_info.h"
29 28
30 // TODO(sky): these includes should not be necessary. Nuke them. 29 // TODO(sky): these includes should not be necessary. Nuke them.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // Returns the type passed to the constructor. 288 // Returns the type passed to the constructor.
290 Type type() const { return type_; } 289 Type type() const { return type_; }
291 290
292 // Optional call to connect the thread name with this loop. 291 // Optional call to connect the thread name with this loop.
293 void set_thread_name(const std::string& thread_name) { 292 void set_thread_name(const std::string& thread_name) {
294 DCHECK(thread_name_.empty()) << "Should not rename this thread!"; 293 DCHECK(thread_name_.empty()) << "Should not rename this thread!";
295 thread_name_ = thread_name; 294 thread_name_ = thread_name;
296 } 295 }
297 const std::string& thread_name() const { return thread_name_; } 296 const std::string& thread_name() const { return thread_name_; }
298 297
299 // Gets the message loop proxy associated with this message loop.
300 //
301 // NOTE: Deprecated; prefer task_runner() and the TaskRunner interfaces
302 scoped_refptr<MessageLoopProxy> message_loop_proxy() {
303 return message_loop_proxy_;
304 }
305
306 // Gets the TaskRunner associated with this message loop. 298 // Gets the TaskRunner associated with this message loop.
307 // TODO(skyostil): Change this to return a const reference to a refptr 299 // TODO(skyostil): Change this to return a const reference to a refptr
308 // once the internal type matches what is being returned (crbug.com/465354). 300 // once the internal type matches what is being returned (crbug.com/465354).
309 scoped_refptr<SingleThreadTaskRunner> task_runner() { 301 scoped_refptr<SingleThreadTaskRunner> task_runner() { return task_runner_; }
310 return message_loop_proxy_;
311 }
312 302
313 // Enables or disables the recursive task processing. This happens in the case 303 // Enables or disables the recursive task processing. This happens in the case
314 // of recursive message loops. Some unwanted message loop may occurs when 304 // of recursive message loops. Some unwanted message loop may occurs when
315 // using common controls or printer functions. By default, recursive task 305 // using common controls or printer functions. By default, recursive task
316 // processing is disabled. 306 // processing is disabled.
317 // 307 //
318 // Please utilize |ScopedNestableTaskAllower| instead of calling these methods 308 // Please utilize |ScopedNestableTaskAllower| instead of calling these methods
319 // directly. In general nestable message loops are to be avoided. They are 309 // directly. In general nestable message loops are to be avoided. They are
320 // dangerous and difficult to get right, so please use with extreme caution. 310 // dangerous and difficult to get right, so please use with extreme caution.
321 // 311 //
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 HistogramBase* message_histogram_; 515 HistogramBase* message_histogram_;
526 516
527 RunLoop* run_loop_; 517 RunLoop* run_loop_;
528 518
529 ObserverList<TaskObserver> task_observers_; 519 ObserverList<TaskObserver> task_observers_;
530 520
531 debug::TaskAnnotator task_annotator_; 521 debug::TaskAnnotator task_annotator_;
532 522
533 scoped_refptr<internal::IncomingTaskQueue> incoming_task_queue_; 523 scoped_refptr<internal::IncomingTaskQueue> incoming_task_queue_;
534 524
535 // The message loop proxy associated with this message loop. 525 // The task runner associated with this message loop.
536 scoped_refptr<internal::MessageLoopProxyImpl> message_loop_proxy_; 526 scoped_refptr<internal::MessageLoopTaskRunner> task_runner_;
537 scoped_ptr<ThreadTaskRunnerHandle> thread_task_runner_handle_; 527 scoped_ptr<ThreadTaskRunnerHandle> thread_task_runner_handle_;
538 528
539 template <class T, class R> friend class base::subtle::DeleteHelperInternal; 529 template <class T, class R> friend class base::subtle::DeleteHelperInternal;
540 template <class T, class R> friend class base::subtle::ReleaseHelperInternal; 530 template <class T, class R> friend class base::subtle::ReleaseHelperInternal;
541 531
542 void DeleteSoonInternal(const tracked_objects::Location& from_here, 532 void DeleteSoonInternal(const tracked_objects::Location& from_here,
543 void(*deleter)(const void*), 533 void(*deleter)(const void*),
544 const void* object); 534 const void* object);
545 void ReleaseSoonInternal(const tracked_objects::Location& from_here, 535 void ReleaseSoonInternal(const tracked_objects::Location& from_here,
546 void(*releaser)(const void*), 536 void(*releaser)(const void*),
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 674
685 // Do not add any member variables to MessageLoopForIO! This is important b/c 675 // Do not add any member variables to MessageLoopForIO! This is important b/c
686 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 676 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
687 // data that you need should be stored on the MessageLoop's pump_ instance. 677 // data that you need should be stored on the MessageLoop's pump_ instance.
688 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 678 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
689 MessageLoopForIO_should_not_have_extra_member_variables); 679 MessageLoopForIO_should_not_have_extra_member_variables);
690 680
691 } // namespace base 681 } // namespace base
692 682
693 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 683 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698