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

Side by Side Diff: base/message_loop.h

Issue 8430004: Revert 107895 - Fully enable about:tracking by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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/location.h ('k') | base/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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_H_ 5 #ifndef BASE_MESSAGE_LOOP_H_
6 #define BASE_MESSAGE_LOOP_H_ 6 #define BASE_MESSAGE_LOOP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
11 11
12 #include "base/base_export.h" 12 #include "base/base_export.h"
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/callback.h" 14 #include "base/callback.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/message_loop_proxy.h" 17 #include "base/message_loop_proxy.h"
18 #include "base/message_pump.h" 18 #include "base/message_pump.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "base/synchronization/lock.h" 20 #include "base/synchronization/lock.h"
21 #include "base/task.h" 21 #include "base/task.h"
22 #include "base/tracking_info.h"
23 #include "base/time.h" 22 #include "base/time.h"
24 23
25 #if defined(OS_WIN) 24 #if defined(OS_WIN)
26 // We need this to declare base::MessagePumpWin::Dispatcher, which we should 25 // We need this to declare base::MessagePumpWin::Dispatcher, which we should
27 // really just eliminate. 26 // really just eliminate.
28 #include "base/message_pump_win.h" 27 #include "base/message_pump_win.h"
29 #elif defined(OS_POSIX) 28 #elif defined(OS_POSIX)
30 #include "base/message_pump_libevent.h" 29 #include "base/message_pump_libevent.h"
31 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 30 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
32 31
33 #if defined(USE_WAYLAND) 32 #if defined(USE_WAYLAND)
34 #include "base/message_pump_wayland.h" 33 #include "base/message_pump_wayland.h"
35 #elif defined(TOUCH_UI) || defined(USE_AURA) 34 #elif defined(TOUCH_UI) || defined(USE_AURA)
36 #include "base/message_pump_x.h" 35 #include "base/message_pump_x.h"
37 #else 36 #else
38 #include "base/message_pump_gtk.h" 37 #include "base/message_pump_gtk.h"
39 #endif 38 #endif
40 39
41 #endif 40 #endif
42 #endif 41 #endif
43 42
44 namespace base { 43 namespace base {
45 class Histogram; 44 class Histogram;
46 } 45 }
47 46
47 #if defined(TRACK_ALL_TASK_OBJECTS)
48 namespace tracked_objects { 48 namespace tracked_objects {
49 class Births; 49 class Births;
50 } 50 }
51 #endif // defined(TRACK_ALL_TASK_OBJECTS)
51 52
52 // A MessageLoop is used to process events for a particular thread. There is 53 // A MessageLoop is used to process events for a particular thread. There is
53 // at most one MessageLoop instance per thread. 54 // at most one MessageLoop instance per thread.
54 // 55 //
55 // Events include at a minimum Task instances submitted to PostTask or those 56 // Events include at a minimum Task instances submitted to PostTask or those
56 // managed by TimerManager. Depending on the type of message pump used by the 57 // managed by TimerManager. Depending on the type of message pump used by the
57 // MessageLoop other events such as UI messages may be processed. On Windows 58 // MessageLoop other events such as UI messages may be processed. On Windows
58 // APC calls (as time permits) and signals sent to a registered set of HANDLEs 59 // APC calls (as time permits) and signals sent to a registered set of HANDLEs
59 // may also be processed. 60 // may also be processed.
60 // 61 //
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 ~AutoRunState(); 403 ~AutoRunState();
403 private: 404 private:
404 MessageLoop* loop_; 405 MessageLoop* loop_;
405 RunState* previous_state_; 406 RunState* previous_state_;
406 }; 407 };
407 #if defined(OS_ANDROID) 408 #if defined(OS_ANDROID)
408 protected: 409 protected:
409 #endif 410 #endif
410 411
411 // This structure is copied around by value. 412 // This structure is copied around by value.
412 struct PendingTask : public base::TrackingInfo { 413 struct PendingTask {
413 PendingTask(const base::Closure& task, 414 PendingTask(const base::Closure& task,
414 const tracked_objects::Location& posted_from, 415 const tracked_objects::Location& posted_from,
415 base::TimeTicks delayed_run_time, 416 base::TimeTicks delayed_run_time,
416 bool nestable); 417 bool nestable);
417 ~PendingTask(); 418 ~PendingTask();
418 419
419 // Used to support sorting. 420 // Used to support sorting.
420 bool operator<(const PendingTask& other) const; 421 bool operator<(const PendingTask& other) const;
421 422
422 // The task to run. 423 // The task to run.
423 base::Closure task; 424 base::Closure task;
424 425
426 #if defined(TRACK_ALL_TASK_OBJECTS)
427 // Counter for location where the Closure was posted from.
428 tracked_objects::Births* post_births;
429 #endif // defined(TRACK_ALL_TASK_OBJECTS)
430
431 // Time this PendingTask was posted.
432 base::TimeTicks time_posted;
433
434 // The time when the task should be run.
435 base::TimeTicks delayed_run_time;
436
425 // The site this PendingTask was posted from. 437 // The site this PendingTask was posted from.
426 tracked_objects::Location posted_from; 438 tracked_objects::Location posted_from;
427 439
428 // Secondary sort key for run time. 440 // Secondary sort key for run time.
429 int sequence_num; 441 int sequence_num;
430 442
431 // OK to dispatch from a nested loop. 443 // OK to dispatch from a nested loop.
432 bool nestable; 444 bool nestable;
433 }; 445 };
434 446
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 #endif // defined(OS_POSIX) 711 #endif // defined(OS_POSIX)
700 }; 712 };
701 713
702 // Do not add any member variables to MessageLoopForIO! This is important b/c 714 // Do not add any member variables to MessageLoopForIO! This is important b/c
703 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 715 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
704 // data that you need should be stored on the MessageLoop's pump_ instance. 716 // data that you need should be stored on the MessageLoop's pump_ instance.
705 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 717 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
706 MessageLoopForIO_should_not_have_extra_member_variables); 718 MessageLoopForIO_should_not_have_extra_member_variables);
707 719
708 #endif // BASE_MESSAGE_LOOP_H_ 720 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/location.h ('k') | base/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698