| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // We'd get a "busy" result if one of the message's handles is: | 141 // We'd get a "busy" result if one of the message's handles is: |
| 142 // - |message_pipe_|'s own handle; | 142 // - |message_pipe_|'s own handle; |
| 143 // - simultaneously being used on another thread; or | 143 // - simultaneously being used on another thread; or |
| 144 // - in a "busy" state that prohibits it from being transferred (e.g., | 144 // - in a "busy" state that prohibits it from being transferred (e.g., |
| 145 // a data pipe handle in the middle of a two-phase read/write, | 145 // a data pipe handle in the middle of a two-phase read/write, |
| 146 // regardless of which thread that two-phase read/write is happening | 146 // regardless of which thread that two-phase read/write is happening |
| 147 // on). | 147 // on). |
| 148 // TODO(vtl): I wonder if this should be a |DCHECK()|. (But, until | 148 // TODO(vtl): I wonder if this should be a |DCHECK()|. (But, until |
| 149 // crbug.com/389666, etc. are resolved, this will make tests fail quickly | 149 // crbug.com/389666, etc. are resolved, this will make tests fail quickly |
| 150 // rather than hanging.) | 150 // rather than hanging.) |
| 151 CHECK(false) << "Race condition or other bug detected"; | 151 // Race condition or other bug detected |
| 152 CHECK(false); |
| 152 return false; | 153 return false; |
| 153 default: | 154 default: |
| 154 // This particular write was rejected, presumably because of bad input. | 155 // This particular write was rejected, presumably because of bad input. |
| 155 // The pipe is not necessarily in a bad state. | 156 // The pipe is not necessarily in a bad state. |
| 156 return false; | 157 return false; |
| 157 } | 158 } |
| 158 return true; | 159 return true; |
| 159 } | 160 } |
| 160 | 161 |
| 161 void Connector::AllowWokenUpBySyncWatchOnSameThread() { | 162 void Connector::AllowWokenUpBySyncWatchOnSameThread() { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 void Connector::EnsureSyncWatcherExists() { | 326 void Connector::EnsureSyncWatcherExists() { |
| 326 if (sync_watcher_) | 327 if (sync_watcher_) |
| 327 return; | 328 return; |
| 328 sync_watcher_.reset(new SyncHandleWatcher( | 329 sync_watcher_.reset(new SyncHandleWatcher( |
| 329 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, | 330 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, |
| 330 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, | 331 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, |
| 331 base::Unretained(this)))); | 332 base::Unretained(this)))); |
| 332 } | 333 } |
| 333 | 334 |
| 334 } // namespace mojo | 335 } // namespace mojo |
| OLD | NEW |