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

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

Issue 1943123002: Make it possible to write a message pipe endpoint's peer into it. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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 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 "mojo/edk/system/platform_handle_dispatcher.h" 5 #include "mojo/edk/system/platform_handle_dispatcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 : platform_handle_(platform_handle.Pass()) {} 79 : platform_handle_(platform_handle.Pass()) {}
80 80
81 PlatformHandleDispatcher::~PlatformHandleDispatcher() {} 81 PlatformHandleDispatcher::~PlatformHandleDispatcher() {}
82 82
83 void PlatformHandleDispatcher::CloseImplNoLock() { 83 void PlatformHandleDispatcher::CloseImplNoLock() {
84 mutex().AssertHeld(); 84 mutex().AssertHeld();
85 platform_handle_.reset(); 85 platform_handle_.reset();
86 } 86 }
87 87
88 RefPtr<Dispatcher> 88 RefPtr<Dispatcher>
89 PlatformHandleDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { 89 PlatformHandleDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock(
90 MessagePipe* /*message_pipe*/,
91 unsigned /*port*/) {
90 mutex().AssertHeld(); 92 mutex().AssertHeld();
93 CancelAllAwakablesNoLock();
91 return Create(platform_handle_.Pass()); 94 return Create(platform_handle_.Pass());
92 } 95 }
93 96
94 void PlatformHandleDispatcher::StartSerializeImplNoLock( 97 void PlatformHandleDispatcher::StartSerializeImplNoLock(
95 Channel* /*channel*/, 98 Channel* /*channel*/,
96 size_t* max_size, 99 size_t* max_size,
97 size_t* max_platform_handles) { 100 size_t* max_platform_handles) {
98 AssertHasOneRef(); // Only one ref => no need to take the lock. 101 AssertHasOneRef(); // Only one ref => no need to take the lock.
99 *max_size = sizeof(SerializedPlatformHandleDispatcher); 102 *max_size = sizeof(SerializedPlatformHandleDispatcher);
100 *max_platform_handles = 1; 103 *max_platform_handles = 1;
(...skipping 14 matching lines...) Expand all
115 } else { 118 } else {
116 serialization->platform_handle_index = kInvalidPlatformHandleIndex; 119 serialization->platform_handle_index = kInvalidPlatformHandleIndex;
117 } 120 }
118 121
119 *actual_size = sizeof(SerializedPlatformHandleDispatcher); 122 *actual_size = sizeof(SerializedPlatformHandleDispatcher);
120 return true; 123 return true;
121 } 124 }
122 125
123 } // namespace system 126 } // namespace system
124 } // namespace mojo 127 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698