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/public/cpp/bindings/connector.h" | 5 #include "mojo/public/cpp/bindings/connector.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 private: | 45 private: |
46 const base::WeakPtr<Connector> connector_; | 46 const base::WeakPtr<Connector> connector_; |
47 RunLoopNestingObserver* const nesting_observer_; | 47 RunLoopNestingObserver* const nesting_observer_; |
48 ActiveDispatchTracker* outer_tracker_ = nullptr; | 48 ActiveDispatchTracker* outer_tracker_ = nullptr; |
49 ActiveDispatchTracker* inner_tracker_ = nullptr; | 49 ActiveDispatchTracker* inner_tracker_ = nullptr; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(ActiveDispatchTracker); | 51 DISALLOW_COPY_AND_ASSIGN(ActiveDispatchTracker); |
52 }; | 52 }; |
53 | 53 |
54 // Watches the MessageLoop on the current thread. Notifies the current chain of | 54 // Watches the MessageLoop on the current thread. Notifies the current chain of |
55 // ActiveDispatchTrackers when a nested message loop is started. | 55 // ActiveDispatchTrackers when a nested run loop is started. |
56 class Connector::RunLoopNestingObserver | 56 class Connector::RunLoopNestingObserver |
57 : public base::RunLoop::NestingObserver, | 57 : public base::RunLoop::NestingObserver, |
58 public base::MessageLoop::DestructionObserver { | 58 public base::MessageLoop::DestructionObserver { |
59 public: | 59 public: |
60 RunLoopNestingObserver() { | 60 RunLoopNestingObserver() { |
61 base::RunLoop::AddNestingObserverOnCurrentThread(this); | 61 base::RunLoop::AddNestingObserverOnCurrentThread(this); |
62 base::MessageLoop::current()->AddDestructionObserver(this); | 62 base::MessageLoop::current()->AddDestructionObserver(this); |
63 } | 63 } |
64 | 64 |
65 ~RunLoopNestingObserver() override {} | 65 ~RunLoopNestingObserver() override {} |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 void Connector::EnsureSyncWatcherExists() { | 485 void Connector::EnsureSyncWatcherExists() { |
486 if (sync_watcher_) | 486 if (sync_watcher_) |
487 return; | 487 return; |
488 sync_watcher_.reset(new SyncHandleWatcher( | 488 sync_watcher_.reset(new SyncHandleWatcher( |
489 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, | 489 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, |
490 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, | 490 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, |
491 base::Unretained(this)))); | 491 base::Unretained(this)))); |
492 } | 492 } |
493 | 493 |
494 } // namespace mojo | 494 } // namespace mojo |
OLD | NEW |