| OLD | NEW |
| 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 #include "mojo/message_pump/message_pump_mojo.h" | 5 #include "mojo/message_pump/message_pump_mojo.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 struct MessagePumpMojo::RunState { | 44 struct MessagePumpMojo::RunState { |
| 45 RunState() : should_quit(false) {} | 45 RunState() : should_quit(false) {} |
| 46 | 46 |
| 47 base::TimeTicks delayed_work_time; | 47 base::TimeTicks delayed_work_time; |
| 48 | 48 |
| 49 bool should_quit; | 49 bool should_quit; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 MessagePumpMojo::MessagePumpMojo() | 52 MessagePumpMojo::MessagePumpMojo() |
| 53 : run_state_(NULL), next_handler_id_(0), event_(false, false) { | 53 : run_state_(NULL), |
| 54 next_handler_id_(0), |
| 55 event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 56 base::WaitableEvent::InitialState::NOT_SIGNALED) { |
| 54 DCHECK(!current()) | 57 DCHECK(!current()) |
| 55 << "There is already a MessagePumpMojo instance on this thread."; | 58 << "There is already a MessagePumpMojo instance on this thread."; |
| 56 g_tls_current_pump.Pointer()->Set(this); | 59 g_tls_current_pump.Pointer()->Set(this); |
| 57 | 60 |
| 58 MojoResult result = CreateMessagePipe(nullptr, &read_handle_, &write_handle_); | 61 MojoResult result = CreateMessagePipe(nullptr, &read_handle_, &write_handle_); |
| 59 CHECK_EQ(result, MOJO_RESULT_OK); | 62 CHECK_EQ(result, MOJO_RESULT_OK); |
| 60 CHECK(read_handle_.is_valid()); | 63 CHECK(read_handle_.is_valid()); |
| 61 CHECK(write_handle_.is_valid()); | 64 CHECK(write_handle_.is_valid()); |
| 62 | 65 |
| 63 MojoHandle handle; | 66 MojoHandle handle; |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 void MessagePumpMojo::WillSignalHandler() { | 439 void MessagePumpMojo::WillSignalHandler() { |
| 437 FOR_EACH_OBSERVER(Observer, observers_, WillSignalHandler()); | 440 FOR_EACH_OBSERVER(Observer, observers_, WillSignalHandler()); |
| 438 } | 441 } |
| 439 | 442 |
| 440 void MessagePumpMojo::DidSignalHandler() { | 443 void MessagePumpMojo::DidSignalHandler() { |
| 441 FOR_EACH_OBSERVER(Observer, observers_, DidSignalHandler()); | 444 FOR_EACH_OBSERVER(Observer, observers_, DidSignalHandler()); |
| 442 } | 445 } |
| 443 | 446 |
| 444 } // namespace common | 447 } // namespace common |
| 445 } // namespace mojo | 448 } // namespace mojo |
| OLD | NEW |