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

Side by Side Diff: ipc/ipc_message.cc

Issue 818833004: Remove deprecated methods from Pickle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 12 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_fuzzing_tests.cc ('k') | ipc/ipc_message_utils.h » ('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_message.h" 5 #include "ipc/ipc_message.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 bool Message::WriteBorrowingFile(const base::PlatformFile& descriptor) { 133 bool Message::WriteBorrowingFile(const base::PlatformFile& descriptor) {
134 // We write the index of the descriptor so that we don't have to 134 // We write the index of the descriptor so that we don't have to
135 // keep the current descriptor as extra decoding state when deserialising. 135 // keep the current descriptor as extra decoding state when deserialising.
136 WriteInt(file_descriptor_set()->size()); 136 WriteInt(file_descriptor_set()->size());
137 return file_descriptor_set()->AddToBorrow(descriptor); 137 return file_descriptor_set()->AddToBorrow(descriptor);
138 } 138 }
139 139
140 bool Message::ReadFile(PickleIterator* iter, base::ScopedFD* descriptor) const { 140 bool Message::ReadFile(PickleIterator* iter, base::ScopedFD* descriptor) const {
141 int descriptor_index; 141 int descriptor_index;
142 if (!ReadInt(iter, &descriptor_index)) 142 if (!iter->ReadInt(&descriptor_index))
143 return false; 143 return false;
144 144
145 FileDescriptorSet* file_descriptor_set = file_descriptor_set_.get(); 145 FileDescriptorSet* file_descriptor_set = file_descriptor_set_.get();
146 if (!file_descriptor_set) 146 if (!file_descriptor_set)
147 return false; 147 return false;
148 148
149 base::PlatformFile file = 149 base::PlatformFile file =
150 file_descriptor_set->TakeDescriptorAt(descriptor_index); 150 file_descriptor_set->TakeDescriptorAt(descriptor_index);
151 if (file < 0) 151 if (file < 0)
152 return false; 152 return false;
153 153
154 descriptor->reset(file); 154 descriptor->reset(file);
155 return true; 155 return true;
156 } 156 }
157 157
158 bool Message::HasFileDescriptors() const { 158 bool Message::HasFileDescriptors() const {
159 return file_descriptor_set_.get() && !file_descriptor_set_->empty(); 159 return file_descriptor_set_.get() && !file_descriptor_set_->empty();
160 } 160 }
161 161
162 void Message::EnsureFileDescriptorSet() { 162 void Message::EnsureFileDescriptorSet() {
163 if (file_descriptor_set_.get() == NULL) 163 if (file_descriptor_set_.get() == NULL)
164 file_descriptor_set_ = new FileDescriptorSet; 164 file_descriptor_set_ = new FileDescriptorSet;
165 } 165 }
166 166
167 #endif 167 #endif
168 168
169 } // namespace IPC 169 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_message_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698