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

Side by Side Diff: ipc/ipc_channel.cc

Issue 1286883003: Revert of IPC: Add attachment brokering support to the message header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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_channel.h ('k') | ipc/ipc_channel_posix.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ipc_channel.h" 5 #include "ipc/ipc_channel.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 23 matching lines...) Expand all
34 int process_id = -1; 34 int process_id = -1;
35 #else 35 #else
36 int process_id = base::GetCurrentProcId(); 36 int process_id = base::GetCurrentProcId();
37 #endif 37 #endif
38 return base::StringPrintf("%d.%u.%d", 38 return base::StringPrintf("%d.%u.%d",
39 process_id, 39 process_id,
40 g_last_id.GetNext(), 40 g_last_id.GetNext(),
41 base::RandInt(0, std::numeric_limits<int32>::max())); 41 base::RandInt(0, std::numeric_limits<int32>::max()));
42 } 42 }
43 43
44 Channel::OutputElement::OutputElement(Message* message)
45 : message_(message), buffer_(nullptr), length_(0) {}
46
47 Channel::OutputElement::OutputElement(void* buffer, size_t length)
48 : message_(nullptr), buffer_(buffer), length_(length) {}
49
50 Channel::OutputElement::~OutputElement() {
51 free(buffer_);
52 }
53
54 size_t Channel::OutputElement::size() const {
55 if (message_)
56 return message_->size();
57 return length_;
58 }
59
60 const void* Channel::OutputElement::data() const {
61 if (message_)
62 return message_->data();
63 return buffer_;
64 }
65
66 } // namespace IPC 44 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel.h ('k') | ipc/ipc_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698