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) |
| 17 #include "chrome/common/x11_util.h" |
16 #endif | 18 #endif |
17 | 19 |
| 20 namespace gfx { |
| 21 class Size; |
| 22 } |
| 23 |
18 // ----------------------------------------------------------------------------- | 24 // ----------------------------------------------------------------------------- |
19 // A TransportDIB is a block of memory that is used to transport pixels | 25 // A TransportDIB is a block of memory that is used to transport pixels |
20 // from the renderer process to the browser. | 26 // from the renderer process to the browser. |
21 // ----------------------------------------------------------------------------- | 27 // ----------------------------------------------------------------------------- |
22 class TransportDIB { | 28 class TransportDIB { |
23 public: | 29 public: |
24 ~TransportDIB(); | 30 ~TransportDIB(); |
25 | 31 |
26 // Two typedefs are defined. A Handle is the type which can be sent over | 32 // Two typedefs are defined. A Handle is the type which can be sent over |
27 // the wire so that the remote side can map the transport DIB. The Id typedef | 33 // the wire so that the remote side can map the transport DIB. The Id typedef |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 size_t size() const { return size_; } | 93 size_t size() const { return size_; } |
88 | 94 |
89 // Return the identifier which can be used to refer to this shared memory | 95 // Return the identifier which can be used to refer to this shared memory |
90 // on the wire. | 96 // on the wire. |
91 Id id() const; | 97 Id id() const; |
92 | 98 |
93 // Return a handle to the underlying shared memory. This can be sent over the | 99 // Return a handle to the underlying shared memory. This can be sent over the |
94 // wire to give this transport DIB to another process. | 100 // wire to give this transport DIB to another process. |
95 Handle handle() const; | 101 Handle handle() const; |
96 | 102 |
| 103 #if defined(OS_LINUX) |
| 104 // Map the shared memory into the X server and return an id for the shared |
| 105 // segment. |
| 106 XID MapToX(Display* connection); |
| 107 #endif |
| 108 |
97 private: | 109 private: |
98 TransportDIB(); | 110 TransportDIB(); |
99 #if defined(OS_WIN) || defined(OS_MACOSX) | 111 #if defined(OS_WIN) || defined(OS_MACOSX) |
100 explicit TransportDIB(base::SharedMemoryHandle dib); | 112 explicit TransportDIB(base::SharedMemoryHandle dib); |
101 base::SharedMemory shared_memory_; | 113 base::SharedMemory shared_memory_; |
102 uint32 sequence_num_; | 114 uint32 sequence_num_; |
103 #elif defined(OS_LINUX) | 115 #elif defined(OS_LINUX) |
104 int key_; // SysV shared memory id | 116 int key_; // SysV shared memory id |
105 void* address_; // mapped address | 117 void* address_; // mapped address |
| 118 XID x_shm_; // X id for the shared segment |
| 119 Display* display_; // connection to the X server |
106 #endif | 120 #endif |
107 size_t size_; // length, in bytes | 121 size_t size_; // length, in bytes |
108 }; | 122 }; |
109 | 123 |
110 class MessageLoop; | 124 class MessageLoop; |
111 | 125 |
112 #endif // CHROME_COMMON_TRANSPORT_DIB_H_ | 126 #endif // CHROME_COMMON_TRANSPORT_DIB_H_ |
OLD | NEW |