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

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

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed output surface lost worker context handling 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 #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 11 matching lines...) Expand all
22 #include "gpu/GLES2/gl2extchromium.h" 22 #include "gpu/GLES2/gl2extchromium.h"
23 #include "gpu/command_buffer/client/gles2_interface.h" 23 #include "gpu/command_buffer/client/gles2_interface.h"
24 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 24 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
25 #include "third_party/khronos/GLES2/gl2.h" 25 #include "third_party/khronos/GLES2/gl2.h"
26 #include "third_party/khronos/GLES2/gl2ext.h" 26 #include "third_party/khronos/GLES2/gl2ext.h"
27 #include "third_party/skia/include/core/SkSurface.h" 27 #include "third_party/skia/include/core/SkSurface.h"
28 #include "third_party/skia/include/gpu/GrContext.h" 28 #include "third_party/skia/include/gpu/GrContext.h"
29 #include "third_party/skia/include/gpu/GrTextureProvider.h" 29 #include "third_party/skia/include/gpu/GrTextureProvider.h"
30 #include "ui/gfx/geometry/rect.h" 30 #include "ui/gfx/geometry/rect.h"
31 #include "ui/gfx/geometry/vector2d.h" 31 #include "ui/gfx/geometry/vector2d.h"
32 #include "ui/gfx/gpu_memory_buffer.h"
33 32
34 using gpu::gles2::GLES2Interface; 33 using gpu::gles2::GLES2Interface;
35 34
36 namespace cc { 35 namespace cc {
37 36
38 class IdAllocator { 37 class IdAllocator {
39 public: 38 public:
40 virtual ~IdAllocator() {} 39 virtual ~IdAllocator() {}
41 40
42 virtual GLuint NextId() = 0; 41 virtual GLuint NextId() = 0;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return kBGRA_8888_GrPixelConfig; 105 return kBGRA_8888_GrPixelConfig;
107 case RGBA_4444: 106 case RGBA_4444:
108 return kRGBA_4444_GrPixelConfig; 107 return kRGBA_4444_GrPixelConfig;
109 default: 108 default:
110 break; 109 break;
111 } 110 }
112 DCHECK(false) << "Unsupported resource format."; 111 DCHECK(false) << "Unsupported resource format.";
113 return kSkia8888_GrPixelConfig; 112 return kSkia8888_GrPixelConfig;
114 } 113 }
115 114
116 gfx::GpuMemoryBuffer::Format ToGpuMemoryBufferFormat(ResourceFormat format) {
117 switch (format) {
118 case RGBA_8888:
119 return gfx::GpuMemoryBuffer::RGBA_8888;
120 case BGRA_8888:
121 return gfx::GpuMemoryBuffer::BGRA_8888;
122 case RGBA_4444:
123 return gfx::GpuMemoryBuffer::RGBA_4444;
124 case ALPHA_8:
125 case LUMINANCE_8:
126 case RGB_565:
127 case ETC1:
128 case RED_8:
129 break;
130 }
131 NOTREACHED();
132 return gfx::GpuMemoryBuffer::RGBA_8888;
133 }
134
135 class ScopedSetActiveTexture { 115 class ScopedSetActiveTexture {
136 public: 116 public:
137 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit) 117 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit)
138 : gl_(gl), unit_(unit) { 118 : gl_(gl), unit_(unit) {
139 DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_)); 119 DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_));
140 120
141 if (unit_ != GL_TEXTURE0) 121 if (unit_ != GL_TEXTURE0)
142 gl_->ActiveTexture(unit_); 122 gl_->ActiveTexture(unit_);
143 } 123 }
144 124
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 next_id_index_ = 0; 175 next_id_index_ = 0;
196 } 176 }
197 177
198 return ids_[next_id_index_++]; 178 return ids_[next_id_index_++];
199 } 179 }
200 180
201 private: 181 private:
202 DISALLOW_COPY_AND_ASSIGN(BufferIdAllocator); 182 DISALLOW_COPY_AND_ASSIGN(BufferIdAllocator);
203 }; 183 };
204 184
205 // Query object based fence implementation used to detect completion of copy
206 // texture operations. Fence has passed when query result is available.
207 class CopyTextureFence : public ResourceProvider::Fence {
208 public:
209 CopyTextureFence(gpu::gles2::GLES2Interface* gl, unsigned query_id)
210 : gl_(gl), query_id_(query_id) {}
211
212 // Overridden from ResourceProvider::Fence:
213 void Set() override {}
214 bool HasPassed() override {
215 unsigned available = 1;
216 gl_->GetQueryObjectuivEXT(
217 query_id_, GL_QUERY_RESULT_AVAILABLE_EXT, &available);
218 if (!available)
219 return false;
220
221 ProcessResult();
222 return true;
223 }
224 void Wait() override {
225 // ProcessResult() will wait for result to become available.
226 ProcessResult();
227 }
228
229 private:
230 ~CopyTextureFence() override {}
231
232 void ProcessResult() {
233 unsigned time_elapsed_us = 0;
234 gl_->GetQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_EXT, &time_elapsed_us);
235 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.CopyTextureLatency", time_elapsed_us,
236 0, 256000, 50);
237 }
238
239 gpu::gles2::GLES2Interface* gl_;
240 unsigned query_id_;
241
242 DISALLOW_COPY_AND_ASSIGN(CopyTextureFence);
243 };
244
245 } // namespace 185 } // namespace
246 186
247 ResourceProvider::Resource::~Resource() {} 187 ResourceProvider::Resource::~Resource() {}
248 188
249 ResourceProvider::Resource::Resource(GLuint texture_id, 189 ResourceProvider::Resource::Resource(GLuint texture_id,
250 const gfx::Size& size, 190 const gfx::Size& size,
251 Origin origin, 191 Origin origin,
252 GLenum target, 192 GLenum target,
253 GLenum filter, 193 GLenum filter,
254 GLenum texture_pool, 194 GLenum texture_pool,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 325
386 ResourceProvider::Child::~Child() {} 326 ResourceProvider::Child::~Child() {}
387 327
388 scoped_ptr<ResourceProvider> ResourceProvider::Create( 328 scoped_ptr<ResourceProvider> ResourceProvider::Create(
389 OutputSurface* output_surface, 329 OutputSurface* output_surface,
390 SharedBitmapManager* shared_bitmap_manager, 330 SharedBitmapManager* shared_bitmap_manager,
391 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 331 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
392 BlockingTaskRunner* blocking_main_thread_task_runner, 332 BlockingTaskRunner* blocking_main_thread_task_runner,
393 int highp_threshold_min, 333 int highp_threshold_min,
394 bool use_rgba_4444_texture_format, 334 bool use_rgba_4444_texture_format,
395 size_t id_allocation_chunk_size, 335 size_t id_allocation_chunk_size) {
396 bool use_persistent_map_for_gpu_memory_buffers) {
397 scoped_ptr<ResourceProvider> resource_provider(new ResourceProvider( 336 scoped_ptr<ResourceProvider> resource_provider(new ResourceProvider(
398 output_surface, shared_bitmap_manager, gpu_memory_buffer_manager, 337 output_surface, shared_bitmap_manager, gpu_memory_buffer_manager,
399 blocking_main_thread_task_runner, highp_threshold_min, 338 blocking_main_thread_task_runner, highp_threshold_min,
400 use_rgba_4444_texture_format, id_allocation_chunk_size, 339 use_rgba_4444_texture_format, id_allocation_chunk_size));
401 use_persistent_map_for_gpu_memory_buffers));
402 resource_provider->Initialize(); 340 resource_provider->Initialize();
403 return resource_provider; 341 return resource_provider;
404 } 342 }
405 343
406 ResourceProvider::~ResourceProvider() { 344 ResourceProvider::~ResourceProvider() {
407 while (!children_.empty()) 345 while (!children_.empty())
408 DestroyChildInternal(children_.begin(), FOR_SHUTDOWN); 346 DestroyChildInternal(children_.begin(), FOR_SHUTDOWN);
409 while (!resources_.empty()) 347 while (!resources_.empty())
410 DeleteResourceInternal(resources_.begin(), FOR_SHUTDOWN); 348 DeleteResourceInternal(resources_.begin(), FOR_SHUTDOWN);
411 349
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 // GpuMemoryBuffer provides direct access to the memory used by the GPU. 920 // GpuMemoryBuffer provides direct access to the memory used by the GPU.
983 // Read lock fences are required to ensure that we're not trying to map a 921 // Read lock fences are required to ensure that we're not trying to map a
984 // buffer that is currently in-use by the GPU. 922 // buffer that is currently in-use by the GPU.
985 resource_->read_lock_fences_enabled = true; 923 resource_->read_lock_fences_enabled = true;
986 } 924 }
987 925
988 gfx::GpuMemoryBuffer* 926 gfx::GpuMemoryBuffer*
989 ResourceProvider::ScopedWriteLockGpuMemoryBuffer::GetGpuMemoryBuffer() { 927 ResourceProvider::ScopedWriteLockGpuMemoryBuffer::GetGpuMemoryBuffer() {
990 if (gpu_memory_buffer_) 928 if (gpu_memory_buffer_)
991 return gpu_memory_buffer_; 929 return gpu_memory_buffer_;
992 gfx::GpuMemoryBuffer::Usage usage =
993 resource_provider_->use_persistent_map_for_gpu_memory_buffers()
994 ? gfx::GpuMemoryBuffer::PERSISTENT_MAP
995 : gfx::GpuMemoryBuffer::MAP;
996 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = 930 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
997 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( 931 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(
998 size_, ToGpuMemoryBufferFormat(format_), usage); 932 size_, ToGpuMemoryBufferFormat(format_), gfx::GpuMemoryBuffer::MAP);
999 gpu_memory_buffer_ = gpu_memory_buffer.release(); 933 gpu_memory_buffer_ = gpu_memory_buffer.release();
1000 return gpu_memory_buffer_; 934 return gpu_memory_buffer_;
1001 } 935 }
1002 936
1003 ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr( 937 ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr(
1004 ResourceProvider* resource_provider, 938 ResourceProvider* resource_provider,
1005 ResourceId resource_id) 939 ResourceId resource_id)
1006 : resource_provider_(resource_provider), 940 : resource_provider_(resource_provider),
1007 resource_(resource_provider->LockForWrite(resource_id)) { 941 resource_(resource_provider->LockForWrite(resource_id)) {
1008 DCHECK(thread_checker_.CalledOnValidThread()); 942 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 gl_->Finish(); 1013 gl_->Finish();
1080 } 1014 }
1081 1015
1082 ResourceProvider::ResourceProvider( 1016 ResourceProvider::ResourceProvider(
1083 OutputSurface* output_surface, 1017 OutputSurface* output_surface,
1084 SharedBitmapManager* shared_bitmap_manager, 1018 SharedBitmapManager* shared_bitmap_manager,
1085 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 1019 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
1086 BlockingTaskRunner* blocking_main_thread_task_runner, 1020 BlockingTaskRunner* blocking_main_thread_task_runner,
1087 int highp_threshold_min, 1021 int highp_threshold_min,
1088 bool use_rgba_4444_texture_format, 1022 bool use_rgba_4444_texture_format,
1089 size_t id_allocation_chunk_size, 1023 size_t id_allocation_chunk_size)
1090 bool use_persistent_map_for_gpu_memory_buffers)
1091 : output_surface_(output_surface), 1024 : output_surface_(output_surface),
1092 shared_bitmap_manager_(shared_bitmap_manager), 1025 shared_bitmap_manager_(shared_bitmap_manager),
1093 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 1026 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
1094 blocking_main_thread_task_runner_(blocking_main_thread_task_runner), 1027 blocking_main_thread_task_runner_(blocking_main_thread_task_runner),
1095 lost_output_surface_(false), 1028 lost_output_surface_(false),
1096 highp_threshold_min_(highp_threshold_min), 1029 highp_threshold_min_(highp_threshold_min),
1097 next_id_(1), 1030 next_id_(1),
1098 next_child_(1), 1031 next_child_(1),
1099 default_resource_type_(RESOURCE_TYPE_BITMAP), 1032 default_resource_type_(RESOURCE_TYPE_BITMAP),
1100 use_texture_storage_ext_(false), 1033 use_texture_storage_ext_(false),
1101 use_texture_format_bgra_(false), 1034 use_texture_format_bgra_(false),
1102 use_texture_usage_hint_(false), 1035 use_texture_usage_hint_(false),
1103 use_compressed_texture_etc1_(false), 1036 use_compressed_texture_etc1_(false),
1104 yuv_resource_format_(LUMINANCE_8), 1037 yuv_resource_format_(LUMINANCE_8),
1105 max_texture_size_(0), 1038 max_texture_size_(0),
1106 best_texture_format_(RGBA_8888), 1039 best_texture_format_(RGBA_8888),
1107 best_render_buffer_format_(RGBA_8888), 1040 best_render_buffer_format_(RGBA_8888),
1108 use_rgba_4444_texture_format_(use_rgba_4444_texture_format), 1041 use_rgba_4444_texture_format_(use_rgba_4444_texture_format),
1109 id_allocation_chunk_size_(id_allocation_chunk_size), 1042 id_allocation_chunk_size_(id_allocation_chunk_size) {
1110 use_sync_query_(false),
1111 use_persistent_map_for_gpu_memory_buffers_(
1112 use_persistent_map_for_gpu_memory_buffers) {
1113 DCHECK(output_surface_->HasClient()); 1043 DCHECK(output_surface_->HasClient());
1114 DCHECK(id_allocation_chunk_size_); 1044 DCHECK(id_allocation_chunk_size_);
1115 } 1045 }
1116 1046
1117 void ResourceProvider::Initialize() { 1047 void ResourceProvider::Initialize() {
1118 DCHECK(thread_checker_.CalledOnValidThread()); 1048 DCHECK(thread_checker_.CalledOnValidThread());
1119 1049
1120 GLES2Interface* gl = ContextGL(); 1050 GLES2Interface* gl = ContextGL();
1121 if (!gl) { 1051 if (!gl) {
1122 default_resource_type_ = RESOURCE_TYPE_BITMAP; 1052 default_resource_type_ = RESOURCE_TYPE_BITMAP;
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 DCHECK(resource->image_id); 1760 DCHECK(resource->image_id);
1831 1761
1832 // Release image currently bound to texture. 1762 // Release image currently bound to texture.
1833 if (resource->bound_image_id) 1763 if (resource->bound_image_id)
1834 gl->ReleaseTexImage2DCHROMIUM(resource->target, resource->bound_image_id); 1764 gl->ReleaseTexImage2DCHROMIUM(resource->target, resource->bound_image_id);
1835 gl->BindTexImage2DCHROMIUM(resource->target, resource->image_id); 1765 gl->BindTexImage2DCHROMIUM(resource->target, resource->image_id);
1836 resource->bound_image_id = resource->image_id; 1766 resource->bound_image_id = resource->image_id;
1837 resource->dirty_image = false; 1767 resource->dirty_image = false;
1838 } 1768 }
1839 1769
1840 void ResourceProvider::CopyResource(ResourceId source_id,
1841 ResourceId dest_id,
1842 const gfx::Rect& rect) {
1843 TRACE_EVENT0("cc", "ResourceProvider::CopyResource");
1844
1845 Resource* source_resource = GetResource(source_id);
1846 DCHECK(!source_resource->lock_for_read_count);
1847 DCHECK(source_resource->origin == Resource::INTERNAL);
1848 DCHECK_EQ(source_resource->exported_count, 0);
1849 DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, source_resource->type);
1850 LazyAllocate(source_resource);
1851
1852 Resource* dest_resource = GetResource(dest_id);
1853 DCHECK(!dest_resource->locked_for_write);
1854 DCHECK(!dest_resource->lock_for_read_count);
1855 DCHECK(dest_resource->origin == Resource::INTERNAL);
1856 DCHECK_EQ(dest_resource->exported_count, 0);
1857 DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, dest_resource->type);
1858 LazyAllocate(dest_resource);
1859
1860 DCHECK_EQ(source_resource->type, dest_resource->type);
1861 DCHECK_EQ(source_resource->format, dest_resource->format);
1862 DCHECK(source_resource->size == dest_resource->size);
1863 DCHECK(gfx::Rect(dest_resource->size).Contains(rect));
1864
1865 GLES2Interface* gl = ContextGL();
1866 DCHECK(gl);
1867 if (source_resource->image_id && source_resource->dirty_image) {
1868 gl->BindTexture(source_resource->target, source_resource->gl_id);
1869 BindImageForSampling(source_resource);
1870 }
1871 if (use_sync_query_) {
1872 if (!source_resource->gl_read_lock_query_id)
1873 gl->GenQueriesEXT(1, &source_resource->gl_read_lock_query_id);
1874 #if defined(OS_CHROMEOS)
1875 // TODO(reveman): This avoids a performance problem on some ChromeOS
1876 // devices. This needs to be removed to support native GpuMemoryBuffer
1877 // implementations. crbug.com/436314
1878 gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM,
1879 source_resource->gl_read_lock_query_id);
1880 #else
1881 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM,
1882 source_resource->gl_read_lock_query_id);
1883 #endif
1884 }
1885 DCHECK(!dest_resource->image_id);
1886 dest_resource->allocated = true;
1887 gl->CopySubTextureCHROMIUM(dest_resource->target, source_resource->gl_id,
1888 dest_resource->gl_id, rect.x(), rect.y(), rect.x(),
1889 rect.y(), rect.width(), rect.height(),
1890 false, false, false);
1891 if (source_resource->gl_read_lock_query_id) {
1892 // End query and create a read lock fence that will prevent access to
1893 // source resource until CopySubTextureCHROMIUM command has completed.
1894 #if defined(OS_CHROMEOS)
1895 gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM);
1896 #else
1897 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM);
1898 #endif
1899 source_resource->read_lock_fence = make_scoped_refptr(
1900 new CopyTextureFence(gl, source_resource->gl_read_lock_query_id));
1901 } else {
1902 // Create a SynchronousFence when CHROMIUM_sync_query extension is missing.
1903 // Try to use one synchronous fence for as many CopyResource operations as
1904 // possible as that reduce the number of times we have to synchronize with
1905 // the GL.
1906 if (!synchronous_fence_.get() || synchronous_fence_->has_synchronized())
1907 synchronous_fence_ = make_scoped_refptr(new SynchronousFence(gl));
1908 source_resource->read_lock_fence = synchronous_fence_;
1909 source_resource->read_lock_fence->Set();
1910 }
1911 }
1912
1913 void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) { 1770 void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) {
1914 Resource* resource = GetResource(id); 1771 Resource* resource = GetResource(id);
1915 DCHECK_EQ(resource->exported_count, 0); 1772 DCHECK_EQ(resource->exported_count, 0);
1916 DCHECK(resource->allocated); 1773 DCHECK(resource->allocated);
1917 if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id) 1774 if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id)
1918 return; 1775 return;
1919 if (!resource->mailbox.sync_point()) 1776 if (!resource->mailbox.sync_point())
1920 return; 1777 return;
1921 DCHECK(resource->mailbox.IsValid()); 1778 DCHECK(resource->mailbox.IsValid());
1922 GLES2Interface* gl = ContextGL(); 1779 GLES2Interface* gl = ContextGL();
1923 DCHECK(gl); 1780 DCHECK(gl);
1924 gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point()); 1781 gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point());
1925 resource->mailbox.set_sync_point(0); 1782 resource->mailbox.set_sync_point(0);
1926 } 1783 }
1927 1784
1928 void ResourceProvider::WaitReadLockIfNeeded(ResourceId id) {
1929 Resource* resource = GetResource(id);
1930 DCHECK_EQ(resource->exported_count, 0);
1931 if (!resource->read_lock_fence.get())
1932 return;
1933
1934 resource->read_lock_fence->Wait();
1935 }
1936
1937 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) { 1785 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) {
1938 GLint active_unit = 0; 1786 GLint active_unit = 0;
1939 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); 1787 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit);
1940 return active_unit; 1788 return active_unit;
1941 } 1789 }
1942 1790
1943 void ResourceProvider::ValidateResource(ResourceId id) const { 1791 void ResourceProvider::ValidateResource(ResourceId id) const {
1944 DCHECK(thread_checker_.CalledOnValidThread()); 1792 DCHECK(thread_checker_.CalledOnValidThread());
1945 DCHECK(id); 1793 DCHECK(id);
1946 DCHECK(resources_.find(id) != resources_.end()); 1794 DCHECK(resources_.find(id) != resources_.end());
1947 } 1795 }
1948 1796
1949 GLES2Interface* ResourceProvider::ContextGL() const { 1797 GLES2Interface* ResourceProvider::ContextGL() const {
1950 ContextProvider* context_provider = output_surface_->context_provider(); 1798 ContextProvider* context_provider = output_surface_->context_provider();
1951 return context_provider ? context_provider->ContextGL() : NULL; 1799 return context_provider ? context_provider->ContextGL() : NULL;
1952 } 1800 }
1953 1801
1954 class GrContext* ResourceProvider::GrContext(bool worker_context) const { 1802 class GrContext* ResourceProvider::GrContext(bool worker_context) const {
1955 ContextProvider* context_provider = 1803 ContextProvider* context_provider =
1956 worker_context ? output_surface_->worker_context_provider() 1804 worker_context ? output_surface_->worker_context_provider()
1957 : output_surface_->context_provider(); 1805 : output_surface_->context_provider();
1958 return context_provider ? context_provider->GrContext() : NULL; 1806 return context_provider ? context_provider->GrContext() : NULL;
1959 } 1807 }
1960 1808
1961 } // namespace cc 1809 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698