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

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

Issue 1753723003: Revert of [mojo-edk] Serialise windows handles into an "extra header" section. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « mojo/edk/system/channel.cc ('k') | mojo/edk/system/channel_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/channel.h" 5 #include "mojo/edk/system/channel.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sys/uio.h> 8 #include <sys/uio.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if (write_error) { 127 if (write_error) {
128 // Do not synchronously invoke OnError(). Write() may have been called by 128 // Do not synchronously invoke OnError(). Write() may have been called by
129 // the delegate and we don't want to re-enter it. 129 // the delegate and we don't want to re-enter it.
130 io_task_runner_->PostTask(FROM_HERE, 130 io_task_runner_->PostTask(FROM_HERE,
131 base::Bind(&ChannelPosix::OnError, this)); 131 base::Bind(&ChannelPosix::OnError, this));
132 } 132 }
133 } 133 }
134 134
135 ScopedPlatformHandleVectorPtr GetReadPlatformHandles( 135 ScopedPlatformHandleVectorPtr GetReadPlatformHandles(
136 size_t num_handles, 136 size_t num_handles,
137 const void* extra_header, 137 void** payload,
138 size_t extra_header_size) override { 138 size_t* payload_size) override {
139 if (incoming_platform_handles_.size() < num_handles) 139 if (incoming_platform_handles_.size() < num_handles)
140 return nullptr; 140 return nullptr;
141
142 ScopedPlatformHandleVectorPtr handles( 141 ScopedPlatformHandleVectorPtr handles(
143 new PlatformHandleVector(num_handles)); 142 new PlatformHandleVector(num_handles));
144 for (size_t i = 0; i < num_handles; ++i) { 143 for (size_t i = 0; i < num_handles; ++i) {
145 (*handles)[i] = incoming_platform_handles_.front(); 144 (*handles)[i] = incoming_platform_handles_.front();
146 incoming_platform_handles_.pop_front(); 145 incoming_platform_handles_.pop_front();
147 } 146 }
148
149 return handles; 147 return handles;
150 } 148 }
151 149
152 private: 150 private:
153 ~ChannelPosix() override { 151 ~ChannelPosix() override {
154 DCHECK(!read_watcher_); 152 DCHECK(!read_watcher_);
155 DCHECK(!write_watcher_); 153 DCHECK(!write_watcher_);
156 for (auto handle : incoming_platform_handles_) 154 for (auto handle : incoming_platform_handles_)
157 handle.CloseIfNecessary(); 155 handle.CloseIfNecessary();
158 } 156 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // static 448 // static
451 scoped_refptr<Channel> Channel::Create( 449 scoped_refptr<Channel> Channel::Create(
452 Delegate* delegate, 450 Delegate* delegate,
453 ScopedPlatformHandle platform_handle, 451 ScopedPlatformHandle platform_handle,
454 scoped_refptr<base::TaskRunner> io_task_runner) { 452 scoped_refptr<base::TaskRunner> io_task_runner) {
455 return new ChannelPosix(delegate, std::move(platform_handle), io_task_runner); 453 return new ChannelPosix(delegate, std::move(platform_handle), io_task_runner);
456 } 454 }
457 455
458 } // namespace edk 456 } // namespace edk
459 } // namespace mojo 457 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/channel.cc ('k') | mojo/edk/system/channel_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698