| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/web_data_consumer_handle_impl.h" | 5 #include "content/child/web_data_consumer_handle_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "mojo/public/c/system/types.h" | 10 #include "mojo/public/c/system/types.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 handle_watcher_.Start( | 73 handle_watcher_.Start( |
| 74 handle_.get(), | 74 handle_.get(), |
| 75 MOJO_HANDLE_SIGNAL_READABLE, | 75 MOJO_HANDLE_SIGNAL_READABLE, |
| 76 MOJO_DEADLINE_INDEFINITE, | 76 MOJO_DEADLINE_INDEFINITE, |
| 77 base::Bind(&WebDataConsumerHandleImpl::OnHandleGotReadable, | 77 base::Bind(&WebDataConsumerHandleImpl::OnHandleGotReadable, |
| 78 base::Unretained(this))); | 78 base::Unretained(this))); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void WebDataConsumerHandleImpl::unregisterClient() { | 81 void WebDataConsumerHandleImpl::unregisterClient() { |
| 82 DCHECK(client_); |
| 82 client_ = nullptr; | 83 client_ = nullptr; |
| 83 handle_watcher_.Stop(); | 84 handle_watcher_.Stop(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 Result WebDataConsumerHandleImpl::HandleReadResult(MojoResult mojo_result) { | 87 Result WebDataConsumerHandleImpl::HandleReadResult(MojoResult mojo_result) { |
| 87 switch (mojo_result) { | 88 switch (mojo_result) { |
| 88 case MOJO_RESULT_OK: | 89 case MOJO_RESULT_OK: |
| 89 return Ok; | 90 return Ok; |
| 90 case MOJO_RESULT_FAILED_PRECONDITION: | 91 case MOJO_RESULT_FAILED_PRECONDITION: |
| 91 return Done; | 92 return Done; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 107 return UnexpectedError; | 108 return UnexpectedError; |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 | 111 |
| 111 void WebDataConsumerHandleImpl::OnHandleGotReadable(MojoResult) { | 112 void WebDataConsumerHandleImpl::OnHandleGotReadable(MojoResult) { |
| 112 DCHECK(client_); | 113 DCHECK(client_); |
| 113 client_->didGetReadable(); | 114 client_->didGetReadable(); |
| 114 } | 115 } |
| 115 | 116 |
| 116 } // namespace content | 117 } // namespace content |
| OLD | NEW |