| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 211 } |
| 212 ReadAllAvailableMessages(); | 212 ReadAllAvailableMessages(); |
| 213 // At this point, this object might have been deleted. Return. | 213 // At this point, this object might have been deleted. Return. |
| 214 } | 214 } |
| 215 | 215 |
| 216 void Connector::WaitToReadMore() { | 216 void Connector::WaitToReadMore() { |
| 217 CHECK(!paused_); | 217 CHECK(!paused_); |
| 218 DCHECK(!handle_watcher_); | 218 DCHECK(!handle_watcher_); |
| 219 | 219 |
| 220 handle_watcher_.reset(new Watcher(FROM_HERE, task_runner_)); | 220 handle_watcher_.reset(new Watcher(FROM_HERE, task_runner_)); |
| 221 handle_watcher_->set_heap_profiler_tag(heap_profiler_tag_); | 221 if (heap_profiler_tag_) |
| 222 handle_watcher_->set_heap_profiler_tag(heap_profiler_tag_); |
| 222 MojoResult rv = handle_watcher_->Start( | 223 MojoResult rv = handle_watcher_->Start( |
| 223 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, | 224 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, |
| 224 base::Bind(&Connector::OnWatcherHandleReady, base::Unretained(this))); | 225 base::Bind(&Connector::OnWatcherHandleReady, base::Unretained(this))); |
| 225 | 226 |
| 226 if (rv != MOJO_RESULT_OK) { | 227 if (rv != MOJO_RESULT_OK) { |
| 227 // If the watch failed because the handle is invalid or its conditions can | 228 // If the watch failed because the handle is invalid or its conditions can |
| 228 // no longer be met, we signal the error asynchronously to avoid reentry. | 229 // no longer be met, we signal the error asynchronously to avoid reentry. |
| 229 task_runner_->PostTask( | 230 task_runner_->PostTask( |
| 230 FROM_HERE, | 231 FROM_HERE, |
| 231 base::Bind(&Connector::OnWatcherHandleReady, weak_self_, rv)); | 232 base::Bind(&Connector::OnWatcherHandleReady, weak_self_, rv)); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 void Connector::EnsureSyncWatcherExists() { | 334 void Connector::EnsureSyncWatcherExists() { |
| 334 if (sync_watcher_) | 335 if (sync_watcher_) |
| 335 return; | 336 return; |
| 336 sync_watcher_.reset(new SyncHandleWatcher( | 337 sync_watcher_.reset(new SyncHandleWatcher( |
| 337 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, | 338 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, |
| 338 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, | 339 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, |
| 339 base::Unretained(this)))); | 340 base::Unretained(this)))); |
| 340 } | 341 } |
| 341 | 342 |
| 342 } // namespace mojo | 343 } // namespace mojo |
| OLD | NEW |