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

Side by Side Diff: sandbox/src/crosscall_client.h

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/sandbox.gyp ('k') | sandbox/src/crosscall_server.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) 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 #ifndef SANDBOX_SRC_CROSSCALL_CLIENT_H__ 5 #ifndef SANDBOX_SRC_CROSSCALL_CLIENT_H_
6 #define SANDBOX_SRC_CROSSCALL_CLIENT_H__ 6 #define SANDBOX_SRC_CROSSCALL_CLIENT_H_
7 7
8 #include "sandbox/src/crosscall_params.h" 8 #include "sandbox/src/crosscall_params.h"
9 #include "sandbox/src/sandbox.h" 9 #include "sandbox/src/sandbox.h"
10 10
11 // This header defines the CrossCall(..) family of templated functions 11 // This header defines the CrossCall(..) family of templated functions
12 // Their purpose is to simulate the syntax of regular call but to generate 12 // Their purpose is to simulate the syntax of regular call but to generate
13 // and IPC from the client-side. 13 // and IPC from the client-side.
14 // 14 //
15 // The basic pattern is to 15 // The basic pattern is to
16 // 1) use template argument deduction to compute the size of each 16 // 1) use template argument deduction to compute the size of each
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Returns this object's type. 79 // Returns this object's type.
80 ArgType GetType() { 80 ArgType GetType() {
81 COMPILE_ASSERT(sizeof(T) == sizeof(uint32), need_specialization); 81 COMPILE_ASSERT(sizeof(T) == sizeof(uint32), need_specialization);
82 return ULONG_TYPE; 82 return ULONG_TYPE;
83 } 83 }
84 84
85 private: 85 private:
86 const T& t_; 86 const T& t_;
87 }; 87 };
88 88
89 // This copy helper template specialization if for the void pointer
90 // case both 32 and 64 bit.
91 template<>
92 class CopyHelper<void*> {
93 public:
94 CopyHelper(void* t) : t_(t) {}
95
96 // Returns the pointer to the start of the input.
97 const void* GetStart() const {
98 return &t_;
99 }
100
101 // Update the stored value with the value in the buffer. This is not
102 // supported for this type.
103 bool Update(void* buffer) {
104 // Not supported;
105 return true;
106 }
107
108 // Returns the size of the input in bytes.
109 size_t GetSize() const {
110 return sizeof(t_);
111 }
112
113 // Returns true if the current type is used as an In or InOut parameter.
114 bool IsInOut() {
115 return false;
116 }
117
118 // Returns this object's type.
119 ArgType GetType() {
120 return VOIDPTR_TYPE;
121 }
122
123 private:
124 const void* t_;
125 };
126
89 // This copy helper template specialization catches the cases where the 127 // This copy helper template specialization catches the cases where the
90 // parameter is a pointer to a string. 128 // parameter is a pointer to a string.
91 template<> 129 template<>
92 class CopyHelper<const wchar_t*> { 130 class CopyHelper<const wchar_t*> {
93 public: 131 public:
94 CopyHelper(const wchar_t* t) 132 CopyHelper(const wchar_t* t)
95 : t_(t) { 133 : t_(t) {
96 } 134 }
97 135
98 // Returns the pointer to the start of the string. 136 // Returns the pointer to the start of the string.
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 XCALL_GEN_UPDATE_PARAM(5, call_params); 474 XCALL_GEN_UPDATE_PARAM(5, call_params);
437 XCALL_GEN_UPDATE_PARAM(6, call_params); 475 XCALL_GEN_UPDATE_PARAM(6, call_params);
438 XCALL_GEN_UPDATE_PARAM(7, call_params); 476 XCALL_GEN_UPDATE_PARAM(7, call_params);
439 XCALL_GEN_FREE_CHANNEL(); 477 XCALL_GEN_FREE_CHANNEL();
440 } 478 }
441 return result; 479 return result;
442 } 480 }
443 } // namespace sandbox 481 } // namespace sandbox
444 482
445 #endif // SANDBOX_SRC_CROSSCALL_CLIENT_H__ 483 #endif // SANDBOX_SRC_CROSSCALL_CLIENT_H__
OLDNEW
« no previous file with comments | « sandbox/sandbox.gyp ('k') | sandbox/src/crosscall_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698