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

Side by Side Diff: ipc/brokerable_attachment.cc

Issue 2473993003: Delete IPC::ChannelPosix, IPC::ChannelWin and IPC::AttachmentBroker. (Closed)
Patch Set: Created 4 years, 1 month 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/brokerable_attachment.h ('k') | ipc/brokerable_attachment_mac.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/brokerable_attachment.h" 5 #include "ipc/brokerable_attachment.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ipc/attachment_broker.h"
11 10
12 namespace IPC { 11 namespace IPC {
13 12
14 // BrokerableAttachment::AttachmentId ------------------------------------------
15 #if !USE_ATTACHMENT_BROKER
16 // static
17 BrokerableAttachment::AttachmentId
18 BrokerableAttachment::AttachmentId::CreateIdWithRandomNonce() {
19 CHECK(false) << "Platforms that don't support attachment brokering shouldn't "
20 "be trying to generating a random nonce.";
21 return AttachmentId();
22 }
23 #endif
24
25 BrokerableAttachment::AttachmentId::AttachmentId() {
26 for (size_t i = 0; i < BrokerableAttachment::kNonceSize; ++i)
27 nonce[i] = 0;
28 }
29
30 BrokerableAttachment::AttachmentId::AttachmentId(const char* start_address,
31 size_t size) {
32 DCHECK(size == BrokerableAttachment::kNonceSize);
33 for (size_t i = 0; i < BrokerableAttachment::kNonceSize; ++i)
34 nonce[i] = start_address[i];
35 }
36
37 void BrokerableAttachment::AttachmentId::SerializeToBuffer(char* start_address,
38 size_t size) {
39 DCHECK(size == BrokerableAttachment::kNonceSize);
40 for (size_t i = 0; i < BrokerableAttachment::kNonceSize; ++i)
41 start_address[i] = nonce[i];
42 }
43
44 // BrokerableAttachment::BrokerableAttachment ---------------------------------- 13 // BrokerableAttachment::BrokerableAttachment ----------------------------------
45 14
46 BrokerableAttachment::BrokerableAttachment() 15 BrokerableAttachment::BrokerableAttachment() = default;
47 : id_(AttachmentId::CreateIdWithRandomNonce()) {}
48 16
49 BrokerableAttachment::BrokerableAttachment(const AttachmentId& id) : id_(id) {} 17 BrokerableAttachment::~BrokerableAttachment() = default;
50
51 BrokerableAttachment::~BrokerableAttachment() {}
52
53 BrokerableAttachment::AttachmentId BrokerableAttachment::GetIdentifier() const {
54 return id_;
55 }
56 18
57 bool BrokerableAttachment::NeedsBrokering() const { 19 bool BrokerableAttachment::NeedsBrokering() const {
58 return GetBrokerableType() == PLACEHOLDER; 20 return GetBrokerableType() == PLACEHOLDER;
59 } 21 }
60 22
61 BrokerableAttachment::Type BrokerableAttachment::GetType() const { 23 BrokerableAttachment::Type BrokerableAttachment::GetType() const {
62 return TYPE_BROKERABLE_ATTACHMENT; 24 return TYPE_BROKERABLE_ATTACHMENT;
63 } 25 }
64 26
65 #if defined(OS_POSIX) 27 #if defined(OS_POSIX)
66 base::PlatformFile BrokerableAttachment::TakePlatformFile() { 28 base::PlatformFile BrokerableAttachment::TakePlatformFile() {
67 NOTREACHED(); 29 NOTREACHED();
68 return base::PlatformFile(); 30 return base::PlatformFile();
69 } 31 }
70 #endif // OS_POSIX 32 #endif // OS_POSIX
71 33
72 } // namespace IPC 34 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/brokerable_attachment.h ('k') | ipc/brokerable_attachment_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698