Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: app/surface/transport_dib.h

Issue 6665029: Adds a TransportDIB::Id value that is explicitly invalid and use it when compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compiles on windows Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | app/surface/transport_dib_linux.cc » ('j') | app/surface/transport_dib_win.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 APP_SURFACE_TRANSPORT_DIB_H_ 5 #ifndef APP_SURFACE_TRANSPORT_DIB_H_
6 #define APP_SURFACE_TRANSPORT_DIB_H_ 6 #define APP_SURFACE_TRANSPORT_DIB_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 sequence_num(seq_num) { 56 sequence_num(seq_num) {
57 } 57 }
58 58
59 bool operator< (const HandleAndSequenceNum& other) const { 59 bool operator< (const HandleAndSequenceNum& other) const {
60 // Use the lexicographic order on the tuple <handle, sequence_num>. 60 // Use the lexicographic order on the tuple <handle, sequence_num>.
61 if (other.handle != handle) 61 if (other.handle != handle)
62 return other.handle < handle; 62 return other.handle < handle;
63 return other.sequence_num < sequence_num; 63 return other.sequence_num < sequence_num;
64 } 64 }
65 65
66 bool operator== (const HandleAndSequenceNum& other) const {
67 return other.handle == handle && other.sequence_num == sequence_num;
68 }
69
66 HANDLE handle; 70 HANDLE handle;
67 uint32 sequence_num; 71 uint32 sequence_num;
68 }; 72 };
69 typedef HandleAndSequenceNum Id; 73 typedef HandleAndSequenceNum Id;
70 74
71 // Returns a default, invalid handle, that is meant to indicate a missing 75 // Returns a default, invalid handle, that is meant to indicate a missing
72 // Transport DIB. 76 // Transport DIB.
73 static Handle DefaultHandleValue() { return NULL; } 77 static Handle DefaultHandleValue() { return NULL; }
74 78
75 // Returns a value that is ONLY USEFUL FOR TESTS WHERE IT WON'T BE 79 // Returns a value that is ONLY USEFUL FOR TESTS WHERE IT WON'T BE
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Returns NULL on failure. 128 // Returns NULL on failure.
125 static TransportDIB* Map(Handle transport_dib); 129 static TransportDIB* Map(Handle transport_dib);
126 130
127 // Create a new |TransportDIB| with a handle to the shared memory. This 131 // Create a new |TransportDIB| with a handle to the shared memory. This
128 // always returns a valid pointer. The DIB is not mapped. 132 // always returns a valid pointer. The DIB is not mapped.
129 static TransportDIB* CreateWithHandle(Handle handle); 133 static TransportDIB* CreateWithHandle(Handle handle);
130 134
131 // Returns true if the handle is valid. 135 // Returns true if the handle is valid.
132 static bool is_valid(Handle dib); 136 static bool is_valid(Handle dib);
133 137
138 // Returns an Id that will never be valid.
139 static Id InvalidId();
140
134 // Returns a canvas using the memory of this TransportDIB. The returned 141 // Returns a canvas using the memory of this TransportDIB. The returned
135 // pointer will be owned by the caller. The bitmap will be of the given size, 142 // pointer will be owned by the caller. The bitmap will be of the given size,
136 // which should fit inside this memory. 143 // which should fit inside this memory.
137 // 144 //
138 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows, 145 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows,
139 // this |TransportDIB| will NOT be mapped and should not be mapped prior, 146 // this |TransportDIB| will NOT be mapped and should not be mapped prior,
140 // because PlatformCanvas will map the file internally. 147 // because PlatformCanvas will map the file internally.
141 // 148 //
142 // Will return NULL on allocation failure. This could be because the image 149 // Will return NULL on allocation failure. This could be because the image
143 // is too large to map into the current process' address space. 150 // is too large to map into the current process' address space.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void* address_; // mapped address 187 void* address_; // mapped address
181 XSharedMemoryId x_shm_; // X id for the shared segment 188 XSharedMemoryId x_shm_; // X id for the shared segment
182 Display* display_; // connection to the X server 189 Display* display_; // connection to the X server
183 #endif 190 #endif
184 size_t size_; // length, in bytes 191 size_t size_; // length, in bytes
185 192
186 DISALLOW_COPY_AND_ASSIGN(TransportDIB); 193 DISALLOW_COPY_AND_ASSIGN(TransportDIB);
187 }; 194 };
188 195
189 #endif // APP_SURFACE_TRANSPORT_DIB_H_ 196 #endif // APP_SURFACE_TRANSPORT_DIB_H_
OLDNEW
« no previous file with comments | « no previous file | app/surface/transport_dib_linux.cc » ('j') | app/surface/transport_dib_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698