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

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

Issue 135273008: cc: Use ResourceProvider::Resouce::type to check the type of the given resource. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Move Origin enum to better place :) Created 6 years, 10 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 | « no previous file | cc/resources/resource_provider.cc » ('j') | cc/resources/resource_provider.cc » ('J')
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 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_
6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 // Enable read lock fences for a specific resource. 356 // Enable read lock fences for a specific resource.
357 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable); 357 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable);
358 358
359 // Indicates if we can currently lock this resource for write. 359 // Indicates if we can currently lock this resource for write.
360 bool CanLockForWrite(ResourceId id); 360 bool CanLockForWrite(ResourceId id);
361 361
362 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); 362 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl);
363 363
364 private: 364 private:
365 struct Resource { 365 struct Resource {
366 enum Origin {
367 Internal,
368 External,
369 Delegated,
370 };
371
366 Resource(); 372 Resource();
367 ~Resource(); 373 ~Resource();
368 Resource(unsigned texture_id, 374 Resource(unsigned texture_id,
369 gfx::Size size, 375 gfx::Size size,
376 Origin origin,
370 GLenum target, 377 GLenum target,
371 GLenum filter, 378 GLenum filter,
372 GLenum texture_pool, 379 GLenum texture_pool,
373 GLint wrap_mode, 380 GLint wrap_mode,
374 TextureUsageHint hint, 381 TextureUsageHint hint,
375 ResourceFormat format); 382 ResourceFormat format);
376 Resource(uint8_t* pixels, 383 Resource(uint8_t* pixels,
377 SharedBitmap* bitmap, 384 SharedBitmap* bitmap,
378 gfx::Size size, 385 gfx::Size size,
386 Origin origin,
379 GLenum filter, 387 GLenum filter,
380 GLint wrap_mode); 388 GLint wrap_mode);
381 389
382 int child_id; 390 int child_id;
383 unsigned gl_id; 391 unsigned gl_id;
384 // Pixel buffer used for set pixels without unnecessary copying. 392 // Pixel buffer used for set pixels without unnecessary copying.
385 unsigned gl_pixel_buffer_id; 393 unsigned gl_pixel_buffer_id;
386 // Query used to determine when asynchronous set pixels complete. 394 // Query used to determine when asynchronous set pixels complete.
387 unsigned gl_upload_query_id; 395 unsigned gl_upload_query_id;
388 TextureMailbox mailbox; 396 TextureMailbox mailbox;
389 ReleaseCallback release_callback; 397 ReleaseCallback release_callback;
390 uint8_t* pixels; 398 uint8_t* pixels;
391 uint8_t* pixel_buffer; 399 uint8_t* pixel_buffer;
392 int lock_for_read_count; 400 int lock_for_read_count;
393 int imported_count; 401 int imported_count;
394 int exported_count; 402 int exported_count;
395 bool locked_for_write; 403 bool locked_for_write;
396 enum Origin {
397 Internal,
398 External,
399 Delegated,
400 };
401 Origin origin; 404 Origin origin;
402 bool marked_for_deletion; 405 bool marked_for_deletion;
403 bool pending_set_pixels; 406 bool pending_set_pixels;
404 bool set_pixels_completion_forced; 407 bool set_pixels_completion_forced;
405 bool allocated; 408 bool allocated;
406 bool enable_read_lock_fences; 409 bool enable_read_lock_fences;
407 scoped_refptr<Fence> read_lock_fence; 410 scoped_refptr<Fence> read_lock_fence;
408 gfx::Size size; 411 gfx::Size size;
409 GLenum target; 412 GLenum target;
410 // TODO(skyostil): Use a separate sampler object for filter state. 413 // TODO(skyostil): Use a separate sampler object for filter state.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 return format_gl_data_format[format]; 560 return format_gl_data_format[format];
558 } 561 }
559 562
560 inline GLenum GLInternalFormat(ResourceFormat format) { 563 inline GLenum GLInternalFormat(ResourceFormat format) {
561 return GLDataFormat(format); 564 return GLDataFormat(format);
562 } 565 }
563 566
564 } // namespace cc 567 } // namespace cc
565 568
566 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 569 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resources/resource_provider.cc » ('j') | cc/resources/resource_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698