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/edk/system/data_pipe_consumer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 NodeController* node_controller = internal::g_core->GetNodeController(); | 396 NodeController* node_controller = internal::g_core->GetNodeController(); |
397 ports::PortRef port; | 397 ports::PortRef port; |
398 if (node_controller->node()->GetPort(ports[0], &port) != ports::OK) | 398 if (node_controller->node()->GetPort(ports[0], &port) != ports::OK) |
399 return nullptr; | 399 return nullptr; |
400 | 400 |
401 PlatformHandle buffer_handle; | 401 PlatformHandle buffer_handle; |
402 std::swap(buffer_handle, handles[0]); | 402 std::swap(buffer_handle, handles[0]); |
403 scoped_refptr<PlatformSharedBuffer> ring_buffer = | 403 scoped_refptr<PlatformSharedBuffer> ring_buffer = |
404 PlatformSharedBuffer::CreateFromPlatformHandle( | 404 PlatformSharedBuffer::CreateFromPlatformHandle( |
405 state->options.capacity_num_bytes, | 405 state->options.capacity_num_bytes, |
| 406 false /* read_only */, |
406 ScopedPlatformHandle(buffer_handle)); | 407 ScopedPlatformHandle(buffer_handle)); |
407 if (!ring_buffer) { | 408 if (!ring_buffer) { |
408 DLOG(ERROR) << "Failed to deserialize shared buffer handle."; | 409 DLOG(ERROR) << "Failed to deserialize shared buffer handle."; |
409 return nullptr; | 410 return nullptr; |
410 } | 411 } |
411 | 412 |
412 scoped_refptr<DataPipeConsumerDispatcher> dispatcher = | 413 scoped_refptr<DataPipeConsumerDispatcher> dispatcher = |
413 new DataPipeConsumerDispatcher(node_controller, port, ring_buffer, | 414 new DataPipeConsumerDispatcher(node_controller, port, ring_buffer, |
414 state->options, false /* initialized */, | 415 state->options, false /* initialized */, |
415 state->pipe_id); | 416 state->pipe_id); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 562 } |
562 | 563 |
563 if (peer_closed_ != was_peer_closed || | 564 if (peer_closed_ != was_peer_closed || |
564 bytes_available_ != previous_bytes_available) { | 565 bytes_available_ != previous_bytes_available) { |
565 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); | 566 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); |
566 } | 567 } |
567 } | 568 } |
568 | 569 |
569 } // namespace edk | 570 } // namespace edk |
570 } // namespace mojo | 571 } // namespace mojo |
OLD | NEW |