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

Side by Side Diff: sandbox/src/crosscall_server.cc

Issue 757001: Second round of sbox changes for 64 bit port... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/src/crosscall_server.h ('k') | sandbox/src/interceptors_64.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "sandbox/src/crosscall_server.h" 8 #include "sandbox/src/crosscall_server.h"
9 #include "sandbox/src/crosscall_params.h" 9 #include "sandbox/src/crosscall_params.h"
10 #include "sandbox/src/crosscall_client.h" 10 #include "sandbox/src/crosscall_client.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 // The size is always computed from the parameter minus the next 170 // The size is always computed from the parameter minus the next
171 // parameter, this works because the message has an extra parameter slot 171 // parameter, this works because the message has an extra parameter slot
172 *size = param_info_[index].size_; 172 *size = param_info_[index].size_;
173 *type = param_info_[index].type_; 173 *type = param_info_[index].type_;
174 174
175 return param_info_[index].offset_ + reinterpret_cast<char*>(this); 175 return param_info_[index].offset_ + reinterpret_cast<char*>(this);
176 } 176 }
177 177
178 // Covers common case for 32 bit integers. 178 // Covers common case for 32 bit integers.
179 bool CrossCallParamsEx::GetParameter32(size_t index, void* param) { 179 bool CrossCallParamsEx::GetParameter32(size_t index, uint32* param) {
180 size_t size = 0; 180 size_t size = 0;
181 ArgType type; 181 ArgType type;
182 void* start = GetRawParameter(index, &size, &type); 182 void* start = GetRawParameter(index, &size, &type);
183 if ((NULL == start) || (4 != size) || (ULONG_TYPE != type)) { 183 if ((NULL == start) || (4 != size) || (ULONG_TYPE != type)) {
184 return false; 184 return false;
185 } 185 }
186 // Copy the 4 bytes. 186 // Copy the 4 bytes.
187 *(reinterpret_cast<uint32*>(param)) = *(reinterpret_cast<uint32*>(start)); 187 *(reinterpret_cast<uint32*>(param)) = *(reinterpret_cast<uint32*>(start));
188 return true; 188 return true;
189 } 189 }
190 190
191 bool CrossCallParamsEx::GetParameterVoidPtr(size_t index, void** param) {
192 size_t size = 0;
193 ArgType type;
194 void* start = GetRawParameter(index, &size, &type);
195 if ((NULL == start) || (sizeof(void*) != size) || (VOIDPTR_TYPE != type)) {
196 return false;
197 }
198 *param = *(reinterpret_cast<void**>(start));
199 return true;
200 }
201
191 // Covers the common case of reading a string. Note that the string is not 202 // Covers the common case of reading a string. Note that the string is not
192 // scanned for invalid characters. 203 // scanned for invalid characters.
193 bool CrossCallParamsEx::GetParameterStr(size_t index, std::wstring* string) { 204 bool CrossCallParamsEx::GetParameterStr(size_t index, std::wstring* string) {
194 size_t size = 0; 205 size_t size = 0;
195 ArgType type; 206 ArgType type;
196 void* start = GetRawParameter(index, &size, &type); 207 void* start = GetRawParameter(index, &size, &type);
197 if (WCHAR_TYPE != type) { 208 if (WCHAR_TYPE != type) {
198 return false; 209 return false;
199 } 210 }
200 211
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 for (; it != ipc_calls_.end(); ++it) { 256 for (; it != ipc_calls_.end(); ++it) {
246 if (it->params.Matches(ipc)) { 257 if (it->params.Matches(ipc)) {
247 *callback = it->callback; 258 *callback = it->callback;
248 return this; 259 return this;
249 } 260 }
250 } 261 }
251 return NULL; 262 return NULL;
252 } 263 }
253 264
254 } // namespace sandbox 265 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/src/crosscall_server.h ('k') | sandbox/src/interceptors_64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698