Don't preload rarely seen large images
[chromium-blink-merge.git] / sandbox / win / src / internal_types.h
blob026bedb06422f0e416e54e58c67944d2f8ff3e66
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
3 // found in the LICENSE file.
5 #ifndef SANDBOX_WIN_SRC_INTERNAL_TYPES_H_
6 #define SANDBOX_WIN_SRC_INTERNAL_TYPES_H_
8 namespace sandbox {
10 const wchar_t kNtdllName[] = L"ntdll.dll";
11 const wchar_t kKerneldllName[] = L"kernel32.dll";
12 const wchar_t kKernelBasedllName[] = L"kernelbase.dll";
14 // Defines the supported C++ types encoding to numeric id. Like a poor's man
15 // RTTI. Note that true C++ RTTI will not work because the types are not
16 // polymorphic anyway.
17 enum ArgType {
18 INVALID_TYPE = 0,
19 WCHAR_TYPE,
20 UINT32_TYPE,
21 UNISTR_TYPE,
22 VOIDPTR_TYPE,
23 INPTR_TYPE,
24 INOUTPTR_TYPE,
25 LAST_TYPE
28 // Encapsulates a pointer to a buffer and the size of the buffer.
29 class CountedBuffer {
30 public:
31 CountedBuffer(void* buffer, uint32 size) : size_(size), buffer_(buffer) {}
33 uint32 Size() const {
34 return size_;
37 void* Buffer() const {
38 return buffer_;
41 private:
42 uint32 size_;
43 void* buffer_;
46 // Helper class to convert void-pointer packed ints for both
47 // 32 and 64 bit builds. This construct is non-portable.
48 class IPCInt {
49 public:
50 explicit IPCInt(void* buffer) {
51 buffer_.vp = buffer;
54 explicit IPCInt(unsigned __int32 i32) {
55 buffer_.vp = NULL;
56 buffer_.i32 = i32;
59 unsigned __int32 As32Bit() const {
60 return buffer_.i32;
63 void* AsVoidPtr() const {
64 return buffer_.vp;
67 private:
68 union U {
69 void* vp;
70 unsigned __int32 i32;
71 } buffer_;
74 } // namespace sandbox
76 #endif // SANDBOX_WIN_SRC_INTERNAL_TYPES_H_