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

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

Issue 1188923003: Stub in more IPC attachment brokering functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. 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
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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 #else 547 #else
548 NOTREACHED(); 548 NOTREACHED();
549 #endif // defined(OS_POSIX) && !defined(OS_NACL) 549 #endif // defined(OS_POSIX) && !defined(OS_NACL)
550 break; 550 break;
551 case MessageAttachment::TYPE_MOJO_HANDLE: { 551 case MessageAttachment::TYPE_MOJO_HANDLE: {
552 mojo::ScopedHandle handle = 552 mojo::ScopedHandle handle =
553 static_cast<IPC::internal::MojoHandleAttachment*>( 553 static_cast<IPC::internal::MojoHandleAttachment*>(
554 attachment.get())->TakeHandle(); 554 attachment.get())->TakeHandle();
555 handles->push_back(handle.release().value()); 555 handles->push_back(handle.release().value());
556 } break; 556 } break;
557 case MessageAttachment::TYPE_WIN_HANDLE: 557 case MessageAttachment::TYPE_BROKERABLE_ATTACHMENT:
558 NOTREACHED(); 558 // Brokerable attachments are handled by the AttachmentBroker so
Tom Sepez 2015/06/19 18:04:11 Still need a NOTREACHED() here.
erikchen 2015/06/23 22:37:00 Done.
559 // there's no need to do anything here.
559 break; 560 break;
560 } 561 }
561 } 562 }
562 563
563 set->CommitAll(); 564 set->CommitAll();
564 } 565 }
565 566
566 return MOJO_RESULT_OK; 567 return MOJO_RESULT_OK;
567 } 568 }
568 569
569 // static 570 // static
570 MojoResult ChannelMojo::WriteToMessageAttachmentSet( 571 MojoResult ChannelMojo::WriteToMessageAttachmentSet(
571 const std::vector<MojoHandle>& handle_buffer, 572 const std::vector<MojoHandle>& handle_buffer,
572 Message* message) { 573 Message* message) {
573 for (size_t i = 0; i < handle_buffer.size(); ++i) { 574 for (size_t i = 0; i < handle_buffer.size(); ++i) {
574 bool ok = message->attachment_set()->AddAttachment( 575 bool ok = message->attachment_set()->AddAttachment(
575 new IPC::internal::MojoHandleAttachment( 576 new IPC::internal::MojoHandleAttachment(
576 mojo::MakeScopedHandle(mojo::Handle(handle_buffer[i])))); 577 mojo::MakeScopedHandle(mojo::Handle(handle_buffer[i]))));
577 DCHECK(ok); 578 DCHECK(ok);
578 if (!ok) { 579 if (!ok) {
579 LOG(ERROR) << "Failed to add new Mojo handle."; 580 LOG(ERROR) << "Failed to add new Mojo handle.";
580 return MOJO_RESULT_UNKNOWN; 581 return MOJO_RESULT_UNKNOWN;
581 } 582 }
582 } 583 }
583 584
584 return MOJO_RESULT_OK; 585 return MOJO_RESULT_OK;
585 } 586 }
586 587
587 } // namespace IPC 588 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698