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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 207943002: cc: Reduce size of cc::ResourceProvider::Resource class (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase; conflict resolution; added missing initializer for bool added by other patch Created 6 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
« no previous file with comments | « cc/resources/resource_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "cc/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ResourceProvider::Resource::Resource() 203 ResourceProvider::Resource::Resource()
204 : child_id(0), 204 : child_id(0),
205 gl_id(0), 205 gl_id(0),
206 gl_pixel_buffer_id(0), 206 gl_pixel_buffer_id(0),
207 gl_upload_query_id(0), 207 gl_upload_query_id(0),
208 pixels(NULL), 208 pixels(NULL),
209 pixel_buffer(NULL), 209 pixel_buffer(NULL),
210 lock_for_read_count(0), 210 lock_for_read_count(0),
211 imported_count(0), 211 imported_count(0),
212 exported_count(0), 212 exported_count(0),
213 dirty_image(false),
213 locked_for_write(false), 214 locked_for_write(false),
214 origin(Internal), 215 lost(false),
215 marked_for_deletion(false), 216 marked_for_deletion(false),
216 pending_set_pixels(false), 217 pending_set_pixels(false),
217 set_pixels_completion_forced(false), 218 set_pixels_completion_forced(false),
218 allocated(false), 219 allocated(false),
219 enable_read_lock_fences(false), 220 enable_read_lock_fences(false),
221 has_shared_bitmap_id(false),
222 allow_overlay(false),
220 read_lock_fence(NULL), 223 read_lock_fence(NULL),
221 size(), 224 size(),
225 origin(Internal),
222 target(0), 226 target(0),
223 original_filter(0), 227 original_filter(0),
224 filter(0), 228 filter(0),
225 image_id(0), 229 image_id(0),
226 bound_image_id(0), 230 bound_image_id(0),
227 dirty_image(false),
228 texture_pool(0), 231 texture_pool(0),
229 wrap_mode(0), 232 wrap_mode(0),
230 lost(false),
231 hint(TextureUsageAny), 233 hint(TextureUsageAny),
232 type(InvalidType), 234 type(InvalidType),
233 format(RGBA_8888), 235 format(RGBA_8888),
234 has_shared_bitmap_id(false),
235 allow_overlay(false),
236 shared_bitmap(NULL) {} 236 shared_bitmap(NULL) {}
237 237
238 ResourceProvider::Resource::~Resource() {} 238 ResourceProvider::Resource::~Resource() {}
239 239
240 ResourceProvider::Resource::Resource(GLuint texture_id, 240 ResourceProvider::Resource::Resource(GLuint texture_id,
241 const gfx::Size& size, 241 const gfx::Size& size,
242 Origin origin, 242 Origin origin,
243 GLenum target, 243 GLenum target,
244 GLenum filter, 244 GLenum filter,
245 GLenum texture_pool, 245 GLenum texture_pool,
246 GLint wrap_mode, 246 GLint wrap_mode,
247 TextureUsageHint hint, 247 TextureUsageHint hint,
248 ResourceFormat format) 248 ResourceFormat format)
249 : child_id(0), 249 : child_id(0),
250 gl_id(texture_id), 250 gl_id(texture_id),
251 gl_pixel_buffer_id(0), 251 gl_pixel_buffer_id(0),
252 gl_upload_query_id(0), 252 gl_upload_query_id(0),
253 pixels(NULL), 253 pixels(NULL),
254 pixel_buffer(NULL), 254 pixel_buffer(NULL),
255 lock_for_read_count(0), 255 lock_for_read_count(0),
256 imported_count(0), 256 imported_count(0),
257 exported_count(0), 257 exported_count(0),
258 dirty_image(false),
258 locked_for_write(false), 259 locked_for_write(false),
259 origin(origin), 260 lost(false),
260 marked_for_deletion(false), 261 marked_for_deletion(false),
261 pending_set_pixels(false), 262 pending_set_pixels(false),
262 set_pixels_completion_forced(false), 263 set_pixels_completion_forced(false),
263 allocated(false), 264 allocated(false),
264 enable_read_lock_fences(false), 265 enable_read_lock_fences(false),
266 has_shared_bitmap_id(false),
267 allow_overlay(false),
265 read_lock_fence(NULL), 268 read_lock_fence(NULL),
266 size(size), 269 size(size),
270 origin(origin),
267 target(target), 271 target(target),
268 original_filter(filter), 272 original_filter(filter),
269 filter(filter), 273 filter(filter),
270 image_id(0), 274 image_id(0),
271 bound_image_id(0), 275 bound_image_id(0),
272 dirty_image(false),
273 texture_pool(texture_pool), 276 texture_pool(texture_pool),
274 wrap_mode(wrap_mode), 277 wrap_mode(wrap_mode),
275 lost(false),
276 hint(hint), 278 hint(hint),
277 type(GLTexture), 279 type(GLTexture),
278 format(format), 280 format(format),
279 has_shared_bitmap_id(false),
280 shared_bitmap(NULL) { 281 shared_bitmap(NULL) {
281 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); 282 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
282 DCHECK_EQ(origin == Internal, !!texture_pool); 283 DCHECK_EQ(origin == Internal, !!texture_pool);
283 } 284 }
284 285
285 ResourceProvider::Resource::Resource(uint8_t* pixels, 286 ResourceProvider::Resource::Resource(uint8_t* pixels,
286 SharedBitmap* bitmap, 287 SharedBitmap* bitmap,
287 const gfx::Size& size, 288 const gfx::Size& size,
288 Origin origin, 289 Origin origin,
289 GLenum filter, 290 GLenum filter,
290 GLint wrap_mode) 291 GLint wrap_mode)
291 : child_id(0), 292 : child_id(0),
292 gl_id(0), 293 gl_id(0),
293 gl_pixel_buffer_id(0), 294 gl_pixel_buffer_id(0),
294 gl_upload_query_id(0), 295 gl_upload_query_id(0),
295 pixels(pixels), 296 pixels(pixels),
296 pixel_buffer(NULL), 297 pixel_buffer(NULL),
297 lock_for_read_count(0), 298 lock_for_read_count(0),
298 imported_count(0), 299 imported_count(0),
299 exported_count(0), 300 exported_count(0),
301 dirty_image(false),
300 locked_for_write(false), 302 locked_for_write(false),
301 origin(origin), 303 lost(false),
302 marked_for_deletion(false), 304 marked_for_deletion(false),
303 pending_set_pixels(false), 305 pending_set_pixels(false),
304 set_pixels_completion_forced(false), 306 set_pixels_completion_forced(false),
305 allocated(false), 307 allocated(false),
306 enable_read_lock_fences(false), 308 enable_read_lock_fences(false),
309 has_shared_bitmap_id(!!bitmap),
310 allow_overlay(false),
307 read_lock_fence(NULL), 311 read_lock_fence(NULL),
308 size(size), 312 size(size),
313 origin(origin),
309 target(0), 314 target(0),
310 original_filter(filter), 315 original_filter(filter),
311 filter(filter), 316 filter(filter),
312 image_id(0), 317 image_id(0),
313 bound_image_id(0), 318 bound_image_id(0),
314 dirty_image(false),
315 texture_pool(0), 319 texture_pool(0),
316 wrap_mode(wrap_mode), 320 wrap_mode(wrap_mode),
317 lost(false),
318 hint(TextureUsageAny), 321 hint(TextureUsageAny),
319 type(Bitmap), 322 type(Bitmap),
320 format(RGBA_8888), 323 format(RGBA_8888),
321 has_shared_bitmap_id(!!bitmap),
322 shared_bitmap(bitmap) { 324 shared_bitmap(bitmap) {
323 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); 325 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
324 DCHECK(origin == Delegated || pixels); 326 DCHECK(origin == Delegated || pixels);
325 if (bitmap) 327 if (bitmap)
326 shared_bitmap_id = bitmap->id(); 328 shared_bitmap_id = bitmap->id();
327 } 329 }
328 330
329 ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id, 331 ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id,
330 const gfx::Size& size, 332 const gfx::Size& size,
331 Origin origin, 333 Origin origin,
332 GLenum filter, 334 GLenum filter,
333 GLint wrap_mode) 335 GLint wrap_mode)
334 : child_id(0), 336 : child_id(0),
335 gl_id(0), 337 gl_id(0),
336 gl_pixel_buffer_id(0), 338 gl_pixel_buffer_id(0),
337 gl_upload_query_id(0), 339 gl_upload_query_id(0),
338 pixels(NULL), 340 pixels(NULL),
339 pixel_buffer(NULL), 341 pixel_buffer(NULL),
340 lock_for_read_count(0), 342 lock_for_read_count(0),
341 imported_count(0), 343 imported_count(0),
342 exported_count(0), 344 exported_count(0),
345 dirty_image(false),
343 locked_for_write(false), 346 locked_for_write(false),
344 origin(origin), 347 lost(false),
345 marked_for_deletion(false), 348 marked_for_deletion(false),
346 pending_set_pixels(false), 349 pending_set_pixels(false),
347 set_pixels_completion_forced(false), 350 set_pixels_completion_forced(false),
348 allocated(false), 351 allocated(false),
349 enable_read_lock_fences(false), 352 enable_read_lock_fences(false),
353 has_shared_bitmap_id(true),
354 allow_overlay(false),
350 read_lock_fence(NULL), 355 read_lock_fence(NULL),
351 size(size), 356 size(size),
357 origin(origin),
352 target(0), 358 target(0),
353 original_filter(filter), 359 original_filter(filter),
354 filter(filter), 360 filter(filter),
355 image_id(0), 361 image_id(0),
356 bound_image_id(0), 362 bound_image_id(0),
357 dirty_image(false),
358 texture_pool(0), 363 texture_pool(0),
359 wrap_mode(wrap_mode), 364 wrap_mode(wrap_mode),
360 lost(false),
361 hint(TextureUsageAny), 365 hint(TextureUsageAny),
362 type(Bitmap), 366 type(Bitmap),
363 format(RGBA_8888), 367 format(RGBA_8888),
364 has_shared_bitmap_id(true),
365 shared_bitmap_id(bitmap_id), 368 shared_bitmap_id(bitmap_id),
366 shared_bitmap(NULL) { 369 shared_bitmap(NULL) {
367 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); 370 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
368 } 371 }
369 372
370 ResourceProvider::RasterBuffer::RasterBuffer( 373 ResourceProvider::RasterBuffer::RasterBuffer(
371 const Resource* resource, 374 const Resource* resource,
372 ResourceProvider* resource_provider) 375 ResourceProvider* resource_provider)
373 : resource_(resource), 376 : resource_(resource),
374 resource_provider_(resource_provider), 377 resource_provider_(resource_provider),
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
2215 ContextProvider* context_provider = output_surface_->context_provider(); 2218 ContextProvider* context_provider = output_surface_->context_provider();
2216 return context_provider ? context_provider->ContextGL() : NULL; 2219 return context_provider ? context_provider->ContextGL() : NULL;
2217 } 2220 }
2218 2221
2219 class GrContext* ResourceProvider::GrContext() const { 2222 class GrContext* ResourceProvider::GrContext() const {
2220 ContextProvider* context_provider = output_surface_->context_provider(); 2223 ContextProvider* context_provider = output_surface_->context_provider();
2221 return context_provider ? context_provider->GrContext() : NULL; 2224 return context_provider ? context_provider->GrContext() : NULL;
2222 } 2225 }
2223 2226
2224 } // namespace cc 2227 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698