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

Side by Side Diff: mojo/message_pump/message_pump_mojo.h

Issue 1358163006: Adds some code to help isolate where crash is happening (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 5 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 | « mojo/message_pump/handle_watcher_unittest.cc ('k') | mojo/message_pump/message_pump_mojo.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 MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_ 5 #ifndef MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_
6 #define MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_ 6 #define MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 static scoped_ptr<base::MessagePump> Create(); 43 static scoped_ptr<base::MessagePump> Create();
44 44
45 // Returns the MessagePumpMojo instance of the current thread, if it exists. 45 // Returns the MessagePumpMojo instance of the current thread, if it exists.
46 static MessagePumpMojo* current(); 46 static MessagePumpMojo* current();
47 47
48 static bool IsCurrent() { return !!current(); } 48 static bool IsCurrent() { return !!current(); }
49 49
50 // Registers a MessagePumpMojoHandler for the specified handle. Only one 50 // Registers a MessagePumpMojoHandler for the specified handle. Only one
51 // handler can be registered for a specified handle. 51 // handler can be registered for a specified handle.
52 // NOTE: a value of 0 for |deadline| indicates an indefinite timeout. 52 // NOTE: a value of 0 for |deadline| indicates an indefinite timeout.
53 void AddHandler(MessagePumpMojoHandler* handler, 53 void AddHandler(int location,
54 MessagePumpMojoHandler* handler,
54 const Handle& handle, 55 const Handle& handle,
55 MojoHandleSignals wait_signals, 56 MojoHandleSignals wait_signals,
56 base::TimeTicks deadline); 57 base::TimeTicks deadline);
57 58
58 void RemoveHandler(const Handle& handle); 59 void RemoveHandler(const Handle& handle);
59 60
60 void AddObserver(Observer*); 61 void AddObserver(Observer*);
61 void RemoveObserver(Observer*); 62 void RemoveObserver(Observer*);
62 63
63 // MessagePump: 64 // MessagePump:
64 void Run(Delegate* delegate) override; 65 void Run(Delegate* delegate) override;
65 void Quit() override; 66 void Quit() override;
66 void ScheduleWork() override; 67 void ScheduleWork() override;
67 void ScheduleDelayedWork(const base::TimeTicks& delayed_work_time) override; 68 void ScheduleDelayedWork(const base::TimeTicks& delayed_work_time) override;
68 69
69 private: 70 private:
70 struct RunState; 71 struct RunState;
71 struct WaitState; 72 struct WaitState;
72 73
73 // Contains the data needed to track a request to AddHandler(). 74 // Contains the data needed to track a request to AddHandler().
74 struct Handler { 75 struct Handler {
75 Handler() : handler(NULL), wait_signals(MOJO_HANDLE_SIGNAL_NONE), id(0) {} 76 Handler()
77 : location(0),
78 handler(nullptr),
79 wait_signals(MOJO_HANDLE_SIGNAL_NONE),
80 id(0) {}
76 81
82 int location;
77 MessagePumpMojoHandler* handler; 83 MessagePumpMojoHandler* handler;
78 MojoHandleSignals wait_signals; 84 MojoHandleSignals wait_signals;
79 base::TimeTicks deadline; 85 base::TimeTicks deadline;
80 // See description of |MessagePumpMojo::next_handler_id_| for details. 86 // See description of |MessagePumpMojo::next_handler_id_| for details.
81 int id; 87 int id;
82 }; 88 };
83 89
84 typedef std::map<Handle, Handler> HandleToHandler; 90 typedef std::map<Handle, Handler> HandleToHandler;
85 91
86 // Implementation of Run(). 92 // Implementation of Run().
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 133
128 base::ObserverList<Observer> observers_; 134 base::ObserverList<Observer> observers_;
129 135
130 DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo); 136 DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo);
131 }; 137 };
132 138
133 } // namespace common 139 } // namespace common
134 } // namespace mojo 140 } // namespace mojo
135 141
136 #endif // MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_ 142 #endif // MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_
OLDNEW
« no previous file with comments | « mojo/message_pump/handle_watcher_unittest.cc ('k') | mojo/message_pump/message_pump_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698