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

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

Issue 1157943004: cc: [WIP] Use worker context and OrderingBarrierCHROMIUM for one-copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: piman's comments. Created 5 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
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ResourceProvider::Resource* resource_; 324 ResourceProvider::Resource* resource_;
325 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 325 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
326 gfx::GpuMemoryBuffer* gpu_memory_buffer_; 326 gfx::GpuMemoryBuffer* gpu_memory_buffer_;
327 gfx::Size size_; 327 gfx::Size size_;
328 ResourceFormat format_; 328 ResourceFormat format_;
329 base::ThreadChecker thread_checker_; 329 base::ThreadChecker thread_checker_;
330 330
331 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); 331 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer);
332 }; 332 };
333 333
334 class CC_EXPORT ScopedWriteLockGpuMemoryBufferForThread {
335 public:
336 ScopedWriteLockGpuMemoryBufferForThread(ResourceProvider* resource_provider,
337 ResourceId resource_id);
338 ~ScopedWriteLockGpuMemoryBufferForThread();
339
340 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer();
341 ContextProvider* worker_context() { return worker_context_; }
342 ResourceFormat format() { return format_; }
343 gfx::Size size() { return size_; }
344
345 unsigned bound_image_id() { return bound_image_id_; }
346 void set_bound_image_id(unsigned id) { bound_image_id_ = id; }
347 unsigned image_id() { return image_id_; }
348 void set_image_id(unsigned id) { image_id_ = id; }
349 unsigned dirty_image() { return dirty_image_; }
350 void set_dirty_image(unsigned id) { dirty_image_ = id; }
351 bool allocated() { return allocated_; }
352 void set_allocated(bool status) { allocated_ = status; }
353 bool read_lock_fences_enabled() { return read_lock_fences_enabled_; }
354 void set_read_lock_fences_enabled(bool status) {
355 read_lock_fences_enabled_ = status;
356 }
357 GLenum internal_format() { return internal_format_; }
358 unsigned source_gl_id() { return source_gl_id_; }
359 unsigned dest_gl_id() { return dest_gl_id_; }
360
361 private:
362 ResourceProvider* resource_provider_;
363 ResourceProvider::Resource* resource_;
364 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
365 gfx::GpuMemoryBuffer* gpu_memory_buffer_;
366 base::ThreadChecker thread_checker_;
367 ContextProvider* worker_context_;
368 unsigned image_id_;
369 unsigned bound_image_id_;
370 bool allocated_;
371 bool dirty_image_;
372 bool read_lock_fences_enabled_;
373 unsigned source_gl_id_;
374 unsigned dest_gl_id_;
piman 2015/07/01 22:11:05 These 2 fields are not initialized. For that matte
sohanjg 2015/07/02 14:40:28 Done.
375 gfx::Size size_;
376 ResourceFormat format_;
377 GLenum internal_format_;
378
379 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBufferForThread);
380 };
381
334 class CC_EXPORT ScopedWriteLockGr { 382 class CC_EXPORT ScopedWriteLockGr {
335 public: 383 public:
336 ScopedWriteLockGr(ResourceProvider* resource_provider, 384 ScopedWriteLockGr(ResourceProvider* resource_provider,
337 ResourceId resource_id); 385 ResourceId resource_id);
338 ~ScopedWriteLockGr(); 386 ~ScopedWriteLockGr();
339 387
340 void InitSkSurface(bool use_distance_field_text, 388 void InitSkSurface(bool use_distance_field_text,
341 bool can_use_lcd_text, 389 bool can_use_lcd_text,
342 int msaa_sample_count); 390 int msaa_sample_count);
343 void ReleaseSkSurface(); 391 void ReleaseSkSurface();
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return format_gl_data_format[format]; 706 return format_gl_data_format[format];
659 } 707 }
660 708
661 inline GLenum GLInternalFormat(ResourceFormat format) { 709 inline GLenum GLInternalFormat(ResourceFormat format) {
662 return GLDataFormat(format); 710 return GLDataFormat(format);
663 } 711 }
664 712
665 } // namespace cc 713 } // namespace cc
666 714
667 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 715 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698