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

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

Issue 2039713004: [mojo-edk] Make the Mojo EDK compile under NaCl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 6 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/core.cc ('k') | mojo/edk/system/node_controller.h » ('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/node_channel.h" 5 #include "mojo/edk/system/node_channel.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 #include <limits> 8 #include <limits>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return true; 140 return true;
141 } 141 }
142 142
143 } // namespace 143 } // namespace
144 144
145 // static 145 // static
146 scoped_refptr<NodeChannel> NodeChannel::Create( 146 scoped_refptr<NodeChannel> NodeChannel::Create(
147 Delegate* delegate, 147 Delegate* delegate,
148 ScopedPlatformHandle platform_handle, 148 ScopedPlatformHandle platform_handle,
149 scoped_refptr<base::TaskRunner> io_task_runner) { 149 scoped_refptr<base::TaskRunner> io_task_runner) {
150 #if defined(OS_NACL)
151 LOG(FATAL) << "Multi-process not yet supported on NaCl";
152 return nullptr;
153 #else
150 return new NodeChannel(delegate, std::move(platform_handle), io_task_runner); 154 return new NodeChannel(delegate, std::move(platform_handle), io_task_runner);
155 #endif
151 } 156 }
152 157
153 // static 158 // static
154 Channel::MessagePtr NodeChannel::CreatePortsMessage(size_t payload_size, 159 Channel::MessagePtr NodeChannel::CreatePortsMessage(size_t payload_size,
155 void** payload, 160 void** payload,
156 size_t num_handles) { 161 size_t num_handles) {
157 return CreateMessage(MessageType::PORTS_MESSAGE, payload_size, num_handles, 162 return CreateMessage(MessageType::PORTS_MESSAGE, payload_size, num_handles,
158 payload); 163 payload);
159 } 164 }
160 165
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 #endif // defined(OS_WIN) 379 #endif // defined(OS_WIN)
375 380
376 WriteChannelMessage(std::move(relay_message)); 381 WriteChannelMessage(std::move(relay_message));
377 } 382 }
378 #endif // defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) 383 #endif // defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS))
379 384
380 NodeChannel::NodeChannel(Delegate* delegate, 385 NodeChannel::NodeChannel(Delegate* delegate,
381 ScopedPlatformHandle platform_handle, 386 ScopedPlatformHandle platform_handle,
382 scoped_refptr<base::TaskRunner> io_task_runner) 387 scoped_refptr<base::TaskRunner> io_task_runner)
383 : delegate_(delegate), 388 : delegate_(delegate),
384 io_task_runner_(io_task_runner), 389 io_task_runner_(io_task_runner)
385 channel_( 390 #if !defined(OS_NACL)
386 Channel::Create(this, std::move(platform_handle), io_task_runner_)) { 391 , channel_(
392 Channel::Create(this, std::move(platform_handle), io_task_runner_))
393 #endif
394 {
387 } 395 }
388 396
389 NodeChannel::~NodeChannel() { 397 NodeChannel::~NodeChannel() {
390 ShutDown(); 398 ShutDown();
391 } 399 }
392 400
393 void NodeChannel::OnChannelMessage(const void* payload, 401 void NodeChannel::OnChannelMessage(const void* payload,
394 size_t payload_size, 402 size_t payload_size,
395 ScopedPlatformHandleVectorPtr handles) { 403 ScopedPlatformHandleVectorPtr handles) {
396 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); 404 DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 782
775 base::AutoLock lock(channel_lock_); 783 base::AutoLock lock(channel_lock_);
776 if (!channel_) 784 if (!channel_)
777 DLOG(ERROR) << "Dropping message on closed channel."; 785 DLOG(ERROR) << "Dropping message on closed channel.";
778 else 786 else
779 channel_->Write(std::move(message)); 787 channel_->Write(std::move(message));
780 } 788 }
781 789
782 } // namespace edk 790 } // namespace edk
783 } // namespace mojo 791 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core.cc ('k') | mojo/edk/system/node_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698