OLD | NEW |
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 #ifndef UI_SURFACE_TRANSPORT_DIB_H_ | 5 #ifndef UI_SURFACE_TRANSPORT_DIB_H_ |
6 #define UI_SURFACE_TRANSPORT_DIB_H_ | 6 #define UI_SURFACE_TRANSPORT_DIB_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/surface/surface_export.h" | 9 #include "ui/surface/surface_export.h" |
10 | 10 |
11 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) | 11 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) |
12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
13 #endif | 13 #endif |
14 | 14 |
15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
16 #include <windows.h> | 16 #include <windows.h> |
17 #elif defined(USE_X11) | 17 #elif defined(USE_X11) |
18 #include "ui/base/x/x11_util.h" | 18 #include "ui/base/x/x11_util.h" |
19 #endif | 19 #endif |
20 | 20 |
21 namespace skia { | 21 class SkCanvas; |
22 class PlatformCanvas; | |
23 } | |
24 | 22 |
25 // ----------------------------------------------------------------------------- | 23 // ----------------------------------------------------------------------------- |
26 // A TransportDIB is a block of memory that is used to transport pixels | 24 // A TransportDIB is a block of memory that is used to transport pixels |
27 // between processes: from the renderer process to the browser, and | 25 // between processes: from the renderer process to the browser, and |
28 // between renderer and plugin processes. | 26 // between renderer and plugin processes. |
29 // ----------------------------------------------------------------------------- | 27 // ----------------------------------------------------------------------------- |
30 class SURFACE_EXPORT TransportDIB { | 28 class SURFACE_EXPORT TransportDIB { |
31 public: | 29 public: |
32 ~TransportDIB(); | 30 ~TransportDIB(); |
33 | 31 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Returns a canvas using the memory of this TransportDIB. The returned | 159 // Returns a canvas using the memory of this TransportDIB. The returned |
162 // pointer will be owned by the caller. The bitmap will be of the given size, | 160 // pointer will be owned by the caller. The bitmap will be of the given size, |
163 // which should fit inside this memory. | 161 // which should fit inside this memory. |
164 // | 162 // |
165 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows, | 163 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows, |
166 // this |TransportDIB| will NOT be mapped and should not be mapped prior, | 164 // this |TransportDIB| will NOT be mapped and should not be mapped prior, |
167 // because PlatformCanvas will map the file internally. | 165 // because PlatformCanvas will map the file internally. |
168 // | 166 // |
169 // Will return NULL on allocation failure. This could be because the image | 167 // Will return NULL on allocation failure. This could be because the image |
170 // is too large to map into the current process' address space. | 168 // is too large to map into the current process' address space. |
171 skia::PlatformCanvas* GetPlatformCanvas(int w, int h); | 169 SkCanvas* GetPlatformCanvas(int w, int h); |
172 | 170 |
173 // Map the DIB into the current process if it is not already. This is used to | 171 // Map the DIB into the current process if it is not already. This is used to |
174 // map a DIB that has already been created. Returns true if the DIB is mapped. | 172 // map a DIB that has already been created. Returns true if the DIB is mapped. |
175 bool Map(); | 173 bool Map(); |
176 | 174 |
177 // Return a pointer to the shared memory. | 175 // Return a pointer to the shared memory. |
178 void* memory() const; | 176 void* memory() const; |
179 | 177 |
180 // Return the maximum size of the shared memory. This is not the amount of | 178 // Return the maximum size of the shared memory. This is not the amount of |
181 // data which is valid, you have to know that via other means, this is simply | 179 // data which is valid, you have to know that via other means, this is simply |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 Display* display_; // connection to the X server | 216 Display* display_; // connection to the X server |
219 size_t inflight_counter_; // How many requests to the X server are in flight | 217 size_t inflight_counter_; // How many requests to the X server are in flight |
220 bool detached_; // If true, delete the transport DIB when it is idle | 218 bool detached_; // If true, delete the transport DIB when it is idle |
221 #endif | 219 #endif |
222 size_t size_; // length, in bytes | 220 size_t size_; // length, in bytes |
223 | 221 |
224 DISALLOW_COPY_AND_ASSIGN(TransportDIB); | 222 DISALLOW_COPY_AND_ASSIGN(TransportDIB); |
225 }; | 223 }; |
226 | 224 |
227 #endif // UI_SURFACE_TRANSPORT_DIB_H_ | 225 #endif // UI_SURFACE_TRANSPORT_DIB_H_ |
OLD | NEW |