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

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

Issue 328263005: cc: Rename DirectRasterWorkerPool to GpuRasterWorkerPool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated build.gn file Created 6 years, 5 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/raster_worker_pool_unittest.cc ('k') | cc/resources/resource_provider.cc » ('j') | 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 #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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 virtual bool HasPassed() = 0; 312 virtual bool HasPassed() = 0;
313 313
314 protected: 314 protected:
315 friend class base::RefCounted<Fence>; 315 friend class base::RefCounted<Fence>;
316 virtual ~Fence() {} 316 virtual ~Fence() {}
317 317
318 private: 318 private:
319 DISALLOW_COPY_AND_ASSIGN(Fence); 319 DISALLOW_COPY_AND_ASSIGN(Fence);
320 }; 320 };
321 321
322 // Returns a canvas for direct rasterization. 322 // Returns a canvas for gpu rasterization.
323 // Call Unmap before the resource can be read or used for compositing. 323 // Call Unmap before the resource can be read or used for compositing.
324 // It is used for direct gpu rasterization. 324 // It is used for direct gpu rasterization.
325 SkCanvas* MapDirectRasterBuffer(ResourceId id); 325 SkCanvas* MapGpuRasterBuffer(ResourceId id);
326 void UnmapDirectRasterBuffer(ResourceId id); 326 void UnmapGpuRasterBuffer(ResourceId id);
327 327
328 // Returns a canvas backed by an image buffer. UnmapImageRasterBuffer 328 // Returns a canvas backed by an image buffer. UnmapImageRasterBuffer
329 // returns true if canvas was written to while mapped. 329 // returns true if canvas was written to while mapped.
330 // Rasterizing to the canvas writes the content into the image buffer, 330 // Rasterizing to the canvas writes the content into the image buffer,
331 // which is internally bound to the underlying resource when read. 331 // which is internally bound to the underlying resource when read.
332 // Call Unmap before the resource can be read or used for compositing. 332 // Call Unmap before the resource can be read or used for compositing.
333 // It is used by ImageRasterWorkerPool. 333 // It is used by ImageRasterWorkerPool.
334 SkCanvas* MapImageRasterBuffer(ResourceId id); 334 SkCanvas* MapImageRasterBuffer(ResourceId id);
335 bool UnmapImageRasterBuffer(ResourceId id); 335 bool UnmapImageRasterBuffer(ResourceId id);
336 336
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 // Indicates if we can currently lock this resource for write. 369 // Indicates if we can currently lock this resource for write.
370 bool CanLockForWrite(ResourceId id); 370 bool CanLockForWrite(ResourceId id);
371 371
372 // Copy pixels from source to destination. 372 // Copy pixels from source to destination.
373 void CopyResource(ResourceId source_id, ResourceId dest_id); 373 void CopyResource(ResourceId source_id, ResourceId dest_id);
374 374
375 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); 375 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl);
376 376
377 private: 377 private:
378 class DirectRasterBuffer; 378 class GpuRasterBuffer;
379 class ImageRasterBuffer; 379 class ImageRasterBuffer;
380 class PixelRasterBuffer; 380 class PixelRasterBuffer;
381 381
382 struct Resource { 382 struct Resource {
383 enum Origin { Internal, External, Delegated }; 383 enum Origin { Internal, External, Delegated };
384 384
385 Resource(); 385 Resource();
386 ~Resource(); 386 ~Resource();
387 Resource(unsigned texture_id, 387 Resource(unsigned texture_id,
388 const gfx::Size& size, 388 const gfx::Size& size,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 GLenum filter; 438 GLenum filter;
439 unsigned image_id; 439 unsigned image_id;
440 unsigned bound_image_id; 440 unsigned bound_image_id;
441 GLenum texture_pool; 441 GLenum texture_pool;
442 GLint wrap_mode; 442 GLint wrap_mode;
443 TextureUsageHint hint; 443 TextureUsageHint hint;
444 ResourceType type; 444 ResourceType type;
445 ResourceFormat format; 445 ResourceFormat format;
446 SharedBitmapId shared_bitmap_id; 446 SharedBitmapId shared_bitmap_id;
447 SharedBitmap* shared_bitmap; 447 SharedBitmap* shared_bitmap;
448 linked_ptr<DirectRasterBuffer> direct_raster_buffer; 448 linked_ptr<GpuRasterBuffer> gpu_raster_buffer;
449 linked_ptr<ImageRasterBuffer> image_raster_buffer; 449 linked_ptr<ImageRasterBuffer> image_raster_buffer;
450 linked_ptr<PixelRasterBuffer> pixel_raster_buffer; 450 linked_ptr<PixelRasterBuffer> pixel_raster_buffer;
451 }; 451 };
452 typedef base::hash_map<ResourceId, Resource> ResourceMap; 452 typedef base::hash_map<ResourceId, Resource> ResourceMap;
453 453
454 class RasterBuffer { 454 class RasterBuffer {
455 public: 455 public:
456 virtual ~RasterBuffer(); 456 virtual ~RasterBuffer();
457 457
458 SkCanvas* LockForWrite(); 458 SkCanvas* LockForWrite();
459 // Returns true if canvas was written to while locked. 459 // Returns true if canvas was written to while locked.
460 bool UnlockForWrite(); 460 bool UnlockForWrite();
461 461
462 protected: 462 protected:
463 RasterBuffer(const Resource* resource, ResourceProvider* resource_provider); 463 RasterBuffer(const Resource* resource, ResourceProvider* resource_provider);
464 const Resource* resource() const { return resource_; } 464 const Resource* resource() const { return resource_; }
465 ResourceProvider* resource_provider() const { return resource_provider_; } 465 ResourceProvider* resource_provider() const { return resource_provider_; }
466 466
467 virtual SkCanvas* DoLockForWrite() = 0; 467 virtual SkCanvas* DoLockForWrite() = 0;
468 virtual bool DoUnlockForWrite() = 0; 468 virtual bool DoUnlockForWrite() = 0;
469 469
470 private: 470 private:
471 const Resource* resource_; 471 const Resource* resource_;
472 ResourceProvider* resource_provider_; 472 ResourceProvider* resource_provider_;
473 SkCanvas* locked_canvas_; 473 SkCanvas* locked_canvas_;
474 int canvas_save_count_; 474 int canvas_save_count_;
475 }; 475 };
476 476
477 class DirectRasterBuffer : public RasterBuffer { 477 class GpuRasterBuffer : public RasterBuffer {
478 public: 478 public:
479 DirectRasterBuffer(const Resource* resource, 479 GpuRasterBuffer(const Resource* resource,
480 ResourceProvider* resource_provider, 480 ResourceProvider* resource_provider,
481 bool use_distance_field_text); 481 bool use_distance_field_text);
482 virtual ~DirectRasterBuffer(); 482 virtual ~GpuRasterBuffer();
483 483
484 protected: 484 protected:
485 virtual SkCanvas* DoLockForWrite() OVERRIDE; 485 virtual SkCanvas* DoLockForWrite() OVERRIDE;
486 virtual bool DoUnlockForWrite() OVERRIDE; 486 virtual bool DoUnlockForWrite() OVERRIDE;
487 skia::RefPtr<SkSurface> CreateSurface(); 487 skia::RefPtr<SkSurface> CreateSurface();
488 488
489 private: 489 private:
490 skia::RefPtr<SkSurface> surface_; 490 skia::RefPtr<SkSurface> surface_;
491 uint32_t surface_generation_id_; 491 uint32_t surface_generation_id_;
492 const bool use_distance_field_text_; 492 const bool use_distance_field_text_;
493 493
494 DISALLOW_COPY_AND_ASSIGN(DirectRasterBuffer); 494 DISALLOW_COPY_AND_ASSIGN(GpuRasterBuffer);
495 }; 495 };
496 496
497 class BitmapRasterBuffer : public RasterBuffer { 497 class BitmapRasterBuffer : public RasterBuffer {
498 public: 498 public:
499 virtual ~BitmapRasterBuffer(); 499 virtual ~BitmapRasterBuffer();
500 500
501 protected: 501 protected:
502 BitmapRasterBuffer(const Resource* resource, 502 BitmapRasterBuffer(const Resource* resource,
503 ResourceProvider* resource_provider); 503 ResourceProvider* resource_provider);
504 504
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 return format_gl_data_format[format]; 702 return format_gl_data_format[format];
703 } 703 }
704 704
705 inline GLenum GLInternalFormat(ResourceFormat format) { 705 inline GLenum GLInternalFormat(ResourceFormat format) {
706 return GLDataFormat(format); 706 return GLDataFormat(format);
707 } 707 }
708 708
709 } // namespace cc 709 } // namespace cc
710 710
711 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 711 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « cc/resources/raster_worker_pool_unittest.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698