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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // between renderer and plugin processes. | 27 // between renderer and plugin processes. |
28 // ----------------------------------------------------------------------------- | 28 // ----------------------------------------------------------------------------- |
29 class SURFACE_EXPORT TransportDIB { | 29 class SURFACE_EXPORT TransportDIB { |
30 public: | 30 public: |
31 ~TransportDIB(); | 31 ~TransportDIB(); |
32 | 32 |
33 // A Handle is the type which can be sent over the wire so that the remote | 33 // A Handle is the type which can be sent over the wire so that the remote |
34 // side can map the transport DIB. | 34 // side can map the transport DIB. |
35 typedef base::SharedMemoryHandle Handle; | 35 typedef base::SharedMemoryHandle Handle; |
36 | 36 |
37 // Returns a default, invalid handle, that is meant to indicate a missing | |
38 // Transport DIB. | |
39 static Handle DefaultHandleValue() { | |
40 return base::SharedMemory::NULLHandle(); | |
41 } | |
42 | |
43 // Create a new TransportDIB, returning NULL on failure. | 37 // Create a new TransportDIB, returning NULL on failure. |
44 // | 38 // |
45 // 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 |
46 // DIB (we may actually allocate more than that to give us better reuse when | 40 // DIB (we may actually allocate more than that to give us better reuse when |
47 // cached). | 41 // cached). |
48 // | 42 // |
49 // The sequence number is used to uniquely identify the transport DIB. It | 43 // The sequence number is used to uniquely identify the transport DIB. It |
50 // should be unique for all transport DIBs ever created in the same | 44 // should be unique for all transport DIBs ever created in the same |
51 // renderer. | 45 // renderer. |
52 static TransportDIB* Create(size_t size, uint32_t sequence_num); | 46 static TransportDIB* Create(size_t size, uint32_t sequence_num); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 92 |
99 explicit TransportDIB(base::SharedMemoryHandle dib); | 93 explicit TransportDIB(base::SharedMemoryHandle dib); |
100 base::SharedMemory shared_memory_; | 94 base::SharedMemory shared_memory_; |
101 uint32_t sequence_num_; | 95 uint32_t sequence_num_; |
102 size_t size_; // length, in bytes | 96 size_t size_; // length, in bytes |
103 | 97 |
104 DISALLOW_COPY_AND_ASSIGN(TransportDIB); | 98 DISALLOW_COPY_AND_ASSIGN(TransportDIB); |
105 }; | 99 }; |
106 | 100 |
107 #endif // UI_SURFACE_TRANSPORT_DIB_H_ | 101 #endif // UI_SURFACE_TRANSPORT_DIB_H_ |
OLD | NEW |