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 "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "ui/surface/surface_export.h" | 10 #include "ui/surface/surface_export.h" |
11 | 11 |
12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
13 #include <windows.h> | 13 #include <windows.h> |
14 #endif | 14 #endif |
15 | 15 |
16 class SkCanvas; | 16 class SkCanvas; |
17 | 17 |
18 // ----------------------------------------------------------------------------- | 18 // ----------------------------------------------------------------------------- |
19 // A TransportDIB is a block of memory that is used to transport pixels | 19 // A TransportDIB is a block of memory that is used to transport pixels |
20 // between processes: from the renderer process to the browser, and | 20 // between processes: from the renderer process to the browser, and |
21 // between renderer and plugin processes. | 21 // between renderer and plugin processes. |
22 // ----------------------------------------------------------------------------- | 22 // ----------------------------------------------------------------------------- |
23 class SURFACE_EXPORT TransportDIB { | 23 class SURFACE_EXPORT TransportDIB { |
24 public: | 24 public: |
25 ~TransportDIB(); | 25 ~TransportDIB(); |
26 | 26 |
27 // A Handle is the type which can be sent over the wire so that the remote | 27 // A Handle is the type which can be sent over the wire so that the remote |
28 // side can map the transport DIB. | 28 // side can map the transport DIB. |
29 #if defined(OS_WIN) | |
30 typedef HANDLE Handle; | |
31 #else // OS_POSIX | |
32 typedef base::SharedMemoryHandle Handle; | 29 typedef base::SharedMemoryHandle Handle; |
33 #endif | |
34 | 30 |
35 // Returns a default, invalid handle, that is meant to indicate a missing | 31 // Returns a default, invalid handle, that is meant to indicate a missing |
36 // Transport DIB. | 32 // Transport DIB. |
37 static Handle DefaultHandleValue() { | 33 static Handle DefaultHandleValue() { |
38 return base::SharedMemory::NULLHandle(); | 34 return base::SharedMemory::NULLHandle(); |
39 } | 35 } |
40 | 36 |
41 // Create a new TransportDIB, returning NULL on failure. | 37 // Create a new TransportDIB, returning NULL on failure. |
42 // | 38 // |
43 // The size is the minimum size in bytes of the memory backing the transport | 39 // The size is the minimum size in bytes of the memory backing the transport |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 91 |
96 explicit TransportDIB(base::SharedMemoryHandle dib); | 92 explicit TransportDIB(base::SharedMemoryHandle dib); |
97 base::SharedMemory shared_memory_; | 93 base::SharedMemory shared_memory_; |
98 uint32 sequence_num_; | 94 uint32 sequence_num_; |
99 size_t size_; // length, in bytes | 95 size_t size_; // length, in bytes |
100 | 96 |
101 DISALLOW_COPY_AND_ASSIGN(TransportDIB); | 97 DISALLOW_COPY_AND_ASSIGN(TransportDIB); |
102 }; | 98 }; |
103 | 99 |
104 #endif // UI_SURFACE_TRANSPORT_DIB_H_ | 100 #endif // UI_SURFACE_TRANSPORT_DIB_H_ |
OLD | NEW |