| 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" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 // Return the maximum size of the shared memory. This is not the amount of | 129 // Return the maximum size of the shared memory. This is not the amount of |
| 130 // data which is valid, you have to know that via other means, this is simply | 130 // data which is valid, you have to know that via other means, this is simply |
| 131 // the maximum amount that /could/ be valid. | 131 // the maximum amount that /could/ be valid. |
| 132 size_t size() const { return size_; } | 132 size_t size() const { return size_; } |
| 133 | 133 |
| 134 // Return the identifier which can be used to refer to this shared memory | 134 // Return the identifier which can be used to refer to this shared memory |
| 135 // on the wire. | 135 // on the wire. |
| 136 Id id() const; | 136 Id id() const; |
| 137 | 137 |
| 138 // Return a handle to the underlying shared memory. This can be sent over the | 138 // Returns a pointer to the SharedMemory object that backs the transport dib. |
| 139 // wire to give this transport DIB to another process. | 139 base::SharedMemory* shared_memory(); |
| 140 Handle handle() const; | |
| 141 | 140 |
| 142 private: | 141 private: |
| 143 TransportDIB(); | 142 TransportDIB(); |
| 144 | 143 |
| 145 // Verifies that the dib can hold a canvas of the requested dimensions. | 144 // Verifies that the dib can hold a canvas of the requested dimensions. |
| 146 bool VerifyCanvasSize(int w, int h); | 145 bool VerifyCanvasSize(int w, int h); |
| 147 | 146 |
| 148 explicit TransportDIB(base::SharedMemoryHandle dib); | 147 explicit TransportDIB(base::SharedMemoryHandle dib); |
| 149 base::SharedMemory shared_memory_; | 148 base::SharedMemory shared_memory_; |
| 150 uint32 sequence_num_; | 149 uint32 sequence_num_; |
| 151 size_t size_; // length, in bytes | 150 size_t size_; // length, in bytes |
| 152 | 151 |
| 153 DISALLOW_COPY_AND_ASSIGN(TransportDIB); | 152 DISALLOW_COPY_AND_ASSIGN(TransportDIB); |
| 154 }; | 153 }; |
| 155 | 154 |
| 156 #endif // UI_SURFACE_TRANSPORT_DIB_H_ | 155 #endif // UI_SURFACE_TRANSPORT_DIB_H_ |
| OLD | NEW |