Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: mojo/edk/system/data_pipe_producer_dispatcher.cc

Issue 1689053003: Support read-only duplicates of Mojo shared buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-shm-interop
Patch Set: Rebase and fix comment. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_producer_dispatcher.h" 5 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 NodeController* node_controller = internal::g_core->GetNodeController(); 378 NodeController* node_controller = internal::g_core->GetNodeController();
379 ports::PortRef port; 379 ports::PortRef port;
380 if (node_controller->node()->GetPort(ports[0], &port) != ports::OK) 380 if (node_controller->node()->GetPort(ports[0], &port) != ports::OK)
381 return nullptr; 381 return nullptr;
382 382
383 PlatformHandle buffer_handle; 383 PlatformHandle buffer_handle;
384 std::swap(buffer_handle, handles[0]); 384 std::swap(buffer_handle, handles[0]);
385 scoped_refptr<PlatformSharedBuffer> ring_buffer = 385 scoped_refptr<PlatformSharedBuffer> ring_buffer =
386 PlatformSharedBuffer::CreateFromPlatformHandle( 386 PlatformSharedBuffer::CreateFromPlatformHandle(
387 state->options.capacity_num_bytes, 387 state->options.capacity_num_bytes,
388 false /* read_only */,
388 ScopedPlatformHandle(buffer_handle)); 389 ScopedPlatformHandle(buffer_handle));
389 if (!ring_buffer) { 390 if (!ring_buffer) {
390 DLOG(ERROR) << "Failed to deserialize shared buffer handle."; 391 DLOG(ERROR) << "Failed to deserialize shared buffer handle.";
391 return nullptr; 392 return nullptr;
392 } 393 }
393 394
394 scoped_refptr<DataPipeProducerDispatcher> dispatcher = 395 scoped_refptr<DataPipeProducerDispatcher> dispatcher =
395 new DataPipeProducerDispatcher(node_controller, port, ring_buffer, 396 new DataPipeProducerDispatcher(node_controller, port, ring_buffer,
396 state->options, false /* initialized */, 397 state->options, false /* initialized */,
397 state->pipe_id); 398 state->pipe_id);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 540 }
540 541
541 if (peer_closed_ != was_peer_closed || 542 if (peer_closed_ != was_peer_closed ||
542 available_capacity_ != previous_capacity) { 543 available_capacity_ != previous_capacity) {
543 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); 544 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock());
544 } 545 }
545 } 546 }
546 547
547 } // namespace edk 548 } // namespace edk
548 } // namespace mojo 549 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/data_pipe_consumer_dispatcher.cc ('k') | mojo/edk/system/shared_buffer_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698