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

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

Issue 668783004: Standardize usage of virtual/override/final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 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/memory/weak_ptr_unittest.cc ('k') | base/message_loop/message_loop_proxy.h » ('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
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 TYPE_JAVA, 108 TYPE_JAVA,
109 #endif // defined(OS_ANDROID) 109 #endif // defined(OS_ANDROID)
110 }; 110 };
111 111
112 // Normally, it is not necessary to instantiate a MessageLoop. Instead, it 112 // Normally, it is not necessary to instantiate a MessageLoop. Instead, it
113 // is typical to make use of the current thread's MessageLoop instance. 113 // is typical to make use of the current thread's MessageLoop instance.
114 explicit MessageLoop(Type type = TYPE_DEFAULT); 114 explicit MessageLoop(Type type = TYPE_DEFAULT);
115 // Creates a TYPE_CUSTOM MessageLoop with the supplied MessagePump, which must 115 // Creates a TYPE_CUSTOM MessageLoop with the supplied MessagePump, which must
116 // be non-NULL. 116 // be non-NULL.
117 explicit MessageLoop(scoped_ptr<base::MessagePump> pump); 117 explicit MessageLoop(scoped_ptr<base::MessagePump> pump);
118 virtual ~MessageLoop(); 118 ~MessageLoop() override;
119 119
120 // Returns the MessageLoop object for the current thread, or null if none. 120 // Returns the MessageLoop object for the current thread, or null if none.
121 static MessageLoop* current(); 121 static MessageLoop* current();
122 122
123 static void EnableHistogrammer(bool enable_histogrammer); 123 static void EnableHistogrammer(bool enable_histogrammer);
124 124
125 typedef scoped_ptr<MessagePump> (MessagePumpFactory)(); 125 typedef scoped_ptr<MessagePump> (MessagePumpFactory)();
126 // Uses the given base::MessagePumpForUIFactory to override the default 126 // Uses the given base::MessagePumpForUIFactory to override the default
127 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory 127 // MessagePump implementation for 'TYPE_UI'. Returns true if the factory
128 // was successfully registered. 128 // was successfully registered.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // Start recording histogram info about events and action IF it was enabled 435 // Start recording histogram info about events and action IF it was enabled
436 // and IF the statistics recorder can accept a registration of our histogram. 436 // and IF the statistics recorder can accept a registration of our histogram.
437 void StartHistogrammer(); 437 void StartHistogrammer();
438 438
439 // Add occurrence of event to our histogram, so that we can see what is being 439 // Add occurrence of event to our histogram, so that we can see what is being
440 // done in a specific MessageLoop instance (i.e., specific thread). 440 // done in a specific MessageLoop instance (i.e., specific thread).
441 // If message_histogram_ is NULL, this is a no-op. 441 // If message_histogram_ is NULL, this is a no-op.
442 void HistogramEvent(int event); 442 void HistogramEvent(int event);
443 443
444 // MessagePump::Delegate methods: 444 // MessagePump::Delegate methods:
445 virtual bool DoWork() override; 445 bool DoWork() override;
446 virtual bool DoDelayedWork(TimeTicks* next_delayed_work_time) override; 446 bool DoDelayedWork(TimeTicks* next_delayed_work_time) override;
447 virtual bool DoIdleWork() override; 447 bool DoIdleWork() override;
448 448
449 const Type type_; 449 const Type type_;
450 450
451 // A list of tasks that need to be processed by this instance. Note that 451 // A list of tasks that need to be processed by this instance. Note that
452 // this queue is only accessed (push/pop) by our current thread. 452 // this queue is only accessed (push/pop) by our current thread.
453 TaskQueue work_queue_; 453 TaskQueue work_queue_;
454 454
455 // How many high resolution tasks are in the pending task queue. This value 455 // How many high resolution tasks are in the pending task queue. This value
456 // increases by N every time we call ReloadWorkQueue() and decreases by 1 456 // increases by N every time we call ReloadWorkQueue() and decreases by 1
457 // every time we call RunTask() if the task needs a high resolution timer. 457 // every time we call RunTask() if the task needs a high resolution timer.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 647
648 // Do not add any member variables to MessageLoopForIO! This is important b/c 648 // Do not add any member variables to MessageLoopForIO! This is important b/c
649 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 649 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
650 // data that you need should be stored on the MessageLoop's pump_ instance. 650 // data that you need should be stored on the MessageLoop's pump_ instance.
651 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 651 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
652 MessageLoopForIO_should_not_have_extra_member_variables); 652 MessageLoopForIO_should_not_have_extra_member_variables);
653 653
654 } // namespace base 654 } // namespace base
655 655
656 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 656 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/memory/weak_ptr_unittest.cc ('k') | base/message_loop/message_loop_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698