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

Side by Side Diff: ipc/brokerable_attachment.cc

Issue 1345633002: ipc: Move //crypto dependency into a Windows-only file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/brokerable_attachment.h ('k') | ipc/brokerable_attachment_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 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 "ipc/attachment_broker.h" 7 #include "ipc/attachment_broker.h"
8 8
9 namespace IPC { 9 namespace IPC {
10 10
11 #if !USE_ATTACHMENT_BROKER
12 BrokerableAttachment::AttachmentId::AttachmentId() {
13 CHECK(false) << "Not allowed to construct an attachment id if the platform "
14 "does not support attachment brokering.";
15 }
16 #endif
17
18 BrokerableAttachment::AttachmentId::AttachmentId(const char* start_address,
19 size_t size) {
20 DCHECK(size == BrokerableAttachment::kNonceSize);
21 for (size_t i = 0; i < BrokerableAttachment::kNonceSize; ++i)
22 nonce[i] = start_address[i];
23 }
24
25 void BrokerableAttachment::AttachmentId::SerializeToBuffer(char* start_address,
26 size_t size) {
27 DCHECK(size == BrokerableAttachment::kNonceSize);
28 for (size_t i = 0; i < BrokerableAttachment::kNonceSize; ++i)
29 start_address[i] = nonce[i];
30 }
31
32 BrokerableAttachment::BrokerableAttachment()
33 : needs_brokering_(false) {}
34
11 BrokerableAttachment::BrokerableAttachment(const AttachmentId& id, 35 BrokerableAttachment::BrokerableAttachment(const AttachmentId& id,
12 bool needs_brokering) 36 bool needs_brokering)
13 : id_(id), needs_brokering_(needs_brokering) {} 37 : id_(id), needs_brokering_(needs_brokering) {}
14 38
15 BrokerableAttachment::~BrokerableAttachment() { 39 BrokerableAttachment::~BrokerableAttachment() {
16 } 40 }
17 41
18 BrokerableAttachment::AttachmentId BrokerableAttachment::GetIdentifier() const { 42 BrokerableAttachment::AttachmentId BrokerableAttachment::GetIdentifier() const {
19 return id_; 43 return id_;
20 } 44 }
21 45
22 bool BrokerableAttachment::NeedsBrokering() const { 46 bool BrokerableAttachment::NeedsBrokering() const {
23 return needs_brokering_; 47 return needs_brokering_;
24 } 48 }
25 49
26 void BrokerableAttachment::SetNeedsBrokering(bool needs_brokering) { 50 void BrokerableAttachment::SetNeedsBrokering(bool needs_brokering) {
27 needs_brokering_ = needs_brokering; 51 needs_brokering_ = needs_brokering;
28 } 52 }
29 53
30 BrokerableAttachment::Type BrokerableAttachment::GetType() const { 54 BrokerableAttachment::Type BrokerableAttachment::GetType() const {
31 return TYPE_BROKERABLE_ATTACHMENT; 55 return TYPE_BROKERABLE_ATTACHMENT;
32 } 56 }
33 57
34 } // namespace IPC 58 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/brokerable_attachment.h ('k') | ipc/brokerable_attachment_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698