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

Side by Side Diff: ipc/mojo/ipc_channel_mojo.cc

Issue 1180313007: IPC: Add new classes required for attachment brokering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from wfh. Created 5 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 | « ipc/ipc_message_attachment.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ipc/mojo/ipc_channel_mojo.h" 5 #include "ipc/mojo/ipc_channel_mojo.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 #else 525 #else
526 NOTREACHED(); 526 NOTREACHED();
527 #endif // defined(OS_POSIX) && !defined(OS_NACL) 527 #endif // defined(OS_POSIX) && !defined(OS_NACL)
528 break; 528 break;
529 case MessageAttachment::TYPE_MOJO_HANDLE: { 529 case MessageAttachment::TYPE_MOJO_HANDLE: {
530 mojo::ScopedHandle handle = 530 mojo::ScopedHandle handle =
531 static_cast<IPC::internal::MojoHandleAttachment*>( 531 static_cast<IPC::internal::MojoHandleAttachment*>(
532 attachment.get())->TakeHandle(); 532 attachment.get())->TakeHandle();
533 handles->push_back(handle.release().value()); 533 handles->push_back(handle.release().value());
534 } break; 534 } break;
535 case MessageAttachment::TYPE_WIN_HANDLE:
536 NOTREACHED();
537 break;
535 } 538 }
536 } 539 }
537 540
538 set->CommitAll(); 541 set->CommitAll();
539 } 542 }
540 543
541 return MOJO_RESULT_OK; 544 return MOJO_RESULT_OK;
542 } 545 }
543 546
544 // static 547 // static
545 MojoResult ChannelMojo::WriteToMessageAttachmentSet( 548 MojoResult ChannelMojo::WriteToMessageAttachmentSet(
546 const std::vector<MojoHandle>& handle_buffer, 549 const std::vector<MojoHandle>& handle_buffer,
547 Message* message) { 550 Message* message) {
548 for (size_t i = 0; i < handle_buffer.size(); ++i) { 551 for (size_t i = 0; i < handle_buffer.size(); ++i) {
549 bool ok = message->attachment_set()->AddAttachment( 552 bool ok = message->attachment_set()->AddAttachment(
550 new IPC::internal::MojoHandleAttachment( 553 new IPC::internal::MojoHandleAttachment(
551 mojo::MakeScopedHandle(mojo::Handle(handle_buffer[i])))); 554 mojo::MakeScopedHandle(mojo::Handle(handle_buffer[i]))));
552 DCHECK(ok); 555 DCHECK(ok);
553 if (!ok) { 556 if (!ok) {
554 LOG(ERROR) << "Failed to add new Mojo handle."; 557 LOG(ERROR) << "Failed to add new Mojo handle.";
555 return MOJO_RESULT_UNKNOWN; 558 return MOJO_RESULT_UNKNOWN;
556 } 559 }
557 } 560 }
558 561
559 return MOJO_RESULT_OK; 562 return MOJO_RESULT_OK;
560 } 563 }
561 564
562 } // namespace IPC 565 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message_attachment.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698