OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 CHROME_COMMON_TRANSPORT_DIB_H_ | 5 #ifndef CHROME_COMMON_TRANSPORT_DIB_H_ |
6 #define CHROME_COMMON_TRANSPORT_DIB_H_ | 6 #define CHROME_COMMON_TRANSPORT_DIB_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 #if defined(OS_WIN) || defined(OS_MACOSX) | 10 #if defined(OS_WIN) || defined(OS_MACOSX) |
11 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
12 #endif | 12 #endif |
13 | 13 |
14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
15 #include <windows.h> | 15 #include <windows.h> |
16 #elif defined(OS_LINUX) | 16 #elif defined(OS_LINUX) |
17 #include "chrome/common/x11_util.h" | 17 #include "chrome/common/x11_util.h" |
18 #endif | 18 #endif |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 class Size; | 21 class Size; |
22 } | 22 } |
| 23 namespace skia { |
| 24 class PlatformCanvas; |
| 25 } |
23 | 26 |
24 // ----------------------------------------------------------------------------- | 27 // ----------------------------------------------------------------------------- |
25 // A TransportDIB is a block of memory that is used to transport pixels | 28 // A TransportDIB is a block of memory that is used to transport pixels |
26 // between processes: from the renderer process to the browser, and | 29 // between processes: from the renderer process to the browser, and |
27 // between renderer and plugin processes. | 30 // between renderer and plugin processes. |
28 // ----------------------------------------------------------------------------- | 31 // ----------------------------------------------------------------------------- |
29 class TransportDIB { | 32 class TransportDIB { |
30 public: | 33 public: |
31 ~TransportDIB(); | 34 ~TransportDIB(); |
32 | 35 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 80 |
78 // Create a new TransportDIB | 81 // Create a new TransportDIB |
79 // size: the minimum size, in bytes | 82 // size: the minimum size, in bytes |
80 // epoch: Windows only: a global counter. See comment above. | 83 // epoch: Windows only: a global counter. See comment above. |
81 // returns: NULL on failure | 84 // returns: NULL on failure |
82 static TransportDIB* Create(size_t size, uint32 sequence_num); | 85 static TransportDIB* Create(size_t size, uint32 sequence_num); |
83 | 86 |
84 // Map the referenced transport DIB. Returns NULL on failure. | 87 // Map the referenced transport DIB. Returns NULL on failure. |
85 static TransportDIB* Map(Handle transport_dib); | 88 static TransportDIB* Map(Handle transport_dib); |
86 | 89 |
| 90 // Returns a canvas using the memory of this TransportDIB. The returned |
| 91 // pointer will be owned by the caller. The bitmap will be of the given size, |
| 92 // which should fit inside this memory. |
| 93 skia::PlatformCanvas* GetPlatformCanvas(int w, int h); |
| 94 |
87 // Return a pointer to the shared memory | 95 // Return a pointer to the shared memory |
88 void* memory() const; | 96 void* memory() const; |
89 | 97 |
90 // Return the maximum size of the shared memory. This is not the amount of | 98 // Return the maximum size of the shared memory. This is not the amount of |
91 // data which is valid, you have to know that via other means, this is simply | 99 // data which is valid, you have to know that via other means, this is simply |
92 // the maximum amount that /could/ be valid. | 100 // the maximum amount that /could/ be valid. |
93 size_t size() const { return size_; } | 101 size_t size() const { return size_; } |
94 | 102 |
95 // Return the identifier which can be used to refer to this shared memory | 103 // Return the identifier which can be used to refer to this shared memory |
96 // on the wire. | 104 // on the wire. |
(...skipping 20 matching lines...) Expand all Loading... |
117 void* address_; // mapped address | 125 void* address_; // mapped address |
118 XID x_shm_; // X id for the shared segment | 126 XID x_shm_; // X id for the shared segment |
119 Display* display_; // connection to the X server | 127 Display* display_; // connection to the X server |
120 #endif | 128 #endif |
121 size_t size_; // length, in bytes | 129 size_t size_; // length, in bytes |
122 }; | 130 }; |
123 | 131 |
124 class MessageLoop; | 132 class MessageLoop; |
125 | 133 |
126 #endif // CHROME_COMMON_TRANSPORT_DIB_H_ | 134 #endif // CHROME_COMMON_TRANSPORT_DIB_H_ |
OLD | NEW |