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

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

Issue 638353002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr in src/… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formating. Created 6 years, 2 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 }; 205 };
206 206
207 } // namespace 207 } // namespace
208 208
209 ResourceProvider::Resource::Resource() 209 ResourceProvider::Resource::Resource()
210 : child_id(0), 210 : child_id(0),
211 gl_id(0), 211 gl_id(0),
212 gl_pixel_buffer_id(0), 212 gl_pixel_buffer_id(0),
213 gl_upload_query_id(0), 213 gl_upload_query_id(0),
214 gl_read_lock_query_id(0), 214 gl_read_lock_query_id(0),
215 pixels(NULL), 215 pixels(nullptr),
216 lock_for_read_count(0), 216 lock_for_read_count(0),
217 imported_count(0), 217 imported_count(0),
218 exported_count(0), 218 exported_count(0),
219 dirty_image(false), 219 dirty_image(false),
220 locked_for_write(false), 220 locked_for_write(false),
221 lost(false), 221 lost(false),
222 marked_for_deletion(false), 222 marked_for_deletion(false),
223 pending_set_pixels(false), 223 pending_set_pixels(false),
224 set_pixels_completion_forced(false), 224 set_pixels_completion_forced(false),
225 allocated(false), 225 allocated(false),
226 read_lock_fences_enabled(false), 226 read_lock_fences_enabled(false),
227 has_shared_bitmap_id(false), 227 has_shared_bitmap_id(false),
228 allow_overlay(false), 228 allow_overlay(false),
229 read_lock_fence(NULL), 229 read_lock_fence(nullptr),
230 size(), 230 size(),
231 origin(Internal), 231 origin(Internal),
232 target(0), 232 target(0),
233 original_filter(0), 233 original_filter(0),
234 filter(0), 234 filter(0),
235 image_id(0), 235 image_id(0),
236 bound_image_id(0), 236 bound_image_id(0),
237 texture_pool(0), 237 texture_pool(0),
238 wrap_mode(0), 238 wrap_mode(0),
239 hint(TextureHintImmutable), 239 hint(TextureHintImmutable),
240 type(InvalidType), 240 type(InvalidType),
241 format(RGBA_8888), 241 format(RGBA_8888),
242 shared_bitmap(NULL) { 242 shared_bitmap(nullptr) {
243 } 243 }
244 244
245 ResourceProvider::Resource::~Resource() {} 245 ResourceProvider::Resource::~Resource() {}
246 246
247 ResourceProvider::Resource::Resource(GLuint texture_id, 247 ResourceProvider::Resource::Resource(GLuint texture_id,
248 const gfx::Size& size, 248 const gfx::Size& size,
249 Origin origin, 249 Origin origin,
250 GLenum target, 250 GLenum target,
251 GLenum filter, 251 GLenum filter,
252 GLenum texture_pool, 252 GLenum texture_pool,
253 GLint wrap_mode, 253 GLint wrap_mode,
254 TextureHint hint, 254 TextureHint hint,
255 ResourceFormat format) 255 ResourceFormat format)
256 : child_id(0), 256 : child_id(0),
257 gl_id(texture_id), 257 gl_id(texture_id),
258 gl_pixel_buffer_id(0), 258 gl_pixel_buffer_id(0),
259 gl_upload_query_id(0), 259 gl_upload_query_id(0),
260 gl_read_lock_query_id(0), 260 gl_read_lock_query_id(0),
261 pixels(NULL), 261 pixels(nullptr),
262 lock_for_read_count(0), 262 lock_for_read_count(0),
263 imported_count(0), 263 imported_count(0),
264 exported_count(0), 264 exported_count(0),
265 dirty_image(false), 265 dirty_image(false),
266 locked_for_write(false), 266 locked_for_write(false),
267 lost(false), 267 lost(false),
268 marked_for_deletion(false), 268 marked_for_deletion(false),
269 pending_set_pixels(false), 269 pending_set_pixels(false),
270 set_pixels_completion_forced(false), 270 set_pixels_completion_forced(false),
271 allocated(false), 271 allocated(false),
272 read_lock_fences_enabled(false), 272 read_lock_fences_enabled(false),
273 has_shared_bitmap_id(false), 273 has_shared_bitmap_id(false),
274 allow_overlay(false), 274 allow_overlay(false),
275 read_lock_fence(NULL), 275 read_lock_fence(nullptr),
276 size(size), 276 size(size),
277 origin(origin), 277 origin(origin),
278 target(target), 278 target(target),
279 original_filter(filter), 279 original_filter(filter),
280 filter(filter), 280 filter(filter),
281 image_id(0), 281 image_id(0),
282 bound_image_id(0), 282 bound_image_id(0),
283 texture_pool(texture_pool), 283 texture_pool(texture_pool),
284 wrap_mode(wrap_mode), 284 wrap_mode(wrap_mode),
285 hint(hint), 285 hint(hint),
286 type(GLTexture), 286 type(GLTexture),
287 format(format), 287 format(format),
288 shared_bitmap(NULL) { 288 shared_bitmap(nullptr) {
289 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); 289 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
290 DCHECK_EQ(origin == Internal, !!texture_pool); 290 DCHECK_EQ(origin == Internal, !!texture_pool);
291 } 291 }
292 292
293 ResourceProvider::Resource::Resource(uint8_t* pixels, 293 ResourceProvider::Resource::Resource(uint8_t* pixels,
294 SharedBitmap* bitmap, 294 SharedBitmap* bitmap,
295 const gfx::Size& size, 295 const gfx::Size& size,
296 Origin origin, 296 Origin origin,
297 GLenum filter, 297 GLenum filter,
298 GLint wrap_mode) 298 GLint wrap_mode)
299 : child_id(0), 299 : child_id(0),
300 gl_id(0), 300 gl_id(0),
301 gl_pixel_buffer_id(0), 301 gl_pixel_buffer_id(0),
302 gl_upload_query_id(0), 302 gl_upload_query_id(0),
303 gl_read_lock_query_id(0), 303 gl_read_lock_query_id(0),
304 pixels(pixels), 304 pixels(pixels),
305 lock_for_read_count(0), 305 lock_for_read_count(0),
306 imported_count(0), 306 imported_count(0),
307 exported_count(0), 307 exported_count(0),
308 dirty_image(false), 308 dirty_image(false),
309 locked_for_write(false), 309 locked_for_write(false),
310 lost(false), 310 lost(false),
311 marked_for_deletion(false), 311 marked_for_deletion(false),
312 pending_set_pixels(false), 312 pending_set_pixels(false),
313 set_pixels_completion_forced(false), 313 set_pixels_completion_forced(false),
314 allocated(false), 314 allocated(false),
315 read_lock_fences_enabled(false), 315 read_lock_fences_enabled(false),
316 has_shared_bitmap_id(!!bitmap), 316 has_shared_bitmap_id(!!bitmap),
317 allow_overlay(false), 317 allow_overlay(false),
318 read_lock_fence(NULL), 318 read_lock_fence(nullptr),
319 size(size), 319 size(size),
320 origin(origin), 320 origin(origin),
321 target(0), 321 target(0),
322 original_filter(filter), 322 original_filter(filter),
323 filter(filter), 323 filter(filter),
324 image_id(0), 324 image_id(0),
325 bound_image_id(0), 325 bound_image_id(0),
326 texture_pool(0), 326 texture_pool(0),
327 wrap_mode(wrap_mode), 327 wrap_mode(wrap_mode),
328 hint(TextureHintImmutable), 328 hint(TextureHintImmutable),
329 type(Bitmap), 329 type(Bitmap),
330 format(RGBA_8888), 330 format(RGBA_8888),
331 shared_bitmap(bitmap) { 331 shared_bitmap(bitmap) {
332 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); 332 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
333 DCHECK(origin == Delegated || pixels); 333 DCHECK(origin == Delegated || pixels);
334 if (bitmap) 334 if (bitmap)
335 shared_bitmap_id = bitmap->id(); 335 shared_bitmap_id = bitmap->id();
336 } 336 }
337 337
338 ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id, 338 ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id,
339 const gfx::Size& size, 339 const gfx::Size& size,
340 Origin origin, 340 Origin origin,
341 GLenum filter, 341 GLenum filter,
342 GLint wrap_mode) 342 GLint wrap_mode)
343 : child_id(0), 343 : child_id(0),
344 gl_id(0), 344 gl_id(0),
345 gl_pixel_buffer_id(0), 345 gl_pixel_buffer_id(0),
346 gl_upload_query_id(0), 346 gl_upload_query_id(0),
347 gl_read_lock_query_id(0), 347 gl_read_lock_query_id(0),
348 pixels(NULL), 348 pixels(nullptr),
349 lock_for_read_count(0), 349 lock_for_read_count(0),
350 imported_count(0), 350 imported_count(0),
351 exported_count(0), 351 exported_count(0),
352 dirty_image(false), 352 dirty_image(false),
353 locked_for_write(false), 353 locked_for_write(false),
354 lost(false), 354 lost(false),
355 marked_for_deletion(false), 355 marked_for_deletion(false),
356 pending_set_pixels(false), 356 pending_set_pixels(false),
357 set_pixels_completion_forced(false), 357 set_pixels_completion_forced(false),
358 allocated(false), 358 allocated(false),
359 read_lock_fences_enabled(false), 359 read_lock_fences_enabled(false),
360 has_shared_bitmap_id(true), 360 has_shared_bitmap_id(true),
361 allow_overlay(false), 361 allow_overlay(false),
362 read_lock_fence(NULL), 362 read_lock_fence(nullptr),
363 size(size), 363 size(size),
364 origin(origin), 364 origin(origin),
365 target(0), 365 target(0),
366 original_filter(filter), 366 original_filter(filter),
367 filter(filter), 367 filter(filter),
368 image_id(0), 368 image_id(0),
369 bound_image_id(0), 369 bound_image_id(0),
370 texture_pool(0), 370 texture_pool(0),
371 wrap_mode(wrap_mode), 371 wrap_mode(wrap_mode),
372 hint(TextureHintImmutable), 372 hint(TextureHintImmutable),
373 type(Bitmap), 373 type(Bitmap),
374 format(RGBA_8888), 374 format(RGBA_8888),
375 shared_bitmap_id(bitmap_id), 375 shared_bitmap_id(bitmap_id),
376 shared_bitmap(NULL) { 376 shared_bitmap(nullptr) {
377 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); 377 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
378 } 378 }
379 379
380 ResourceProvider::Child::Child() : marked_for_deletion(false) {} 380 ResourceProvider::Child::Child() : marked_for_deletion(false) {}
381 381
382 ResourceProvider::Child::~Child() {} 382 ResourceProvider::Child::~Child() {}
383 383
384 scoped_ptr<ResourceProvider> ResourceProvider::Create( 384 scoped_ptr<ResourceProvider> ResourceProvider::Create(
385 OutputSurface* output_surface, 385 OutputSurface* output_surface,
386 SharedBitmapManager* shared_bitmap_manager, 386 SharedBitmapManager* shared_bitmap_manager,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 GLC(gl, gl->DeleteTextures(1, &resource->gl_id)); 668 GLC(gl, gl->DeleteTextures(1, &resource->gl_id));
669 resource->gl_id = 0; 669 resource->gl_id = 0;
670 if (!lost_resource) 670 if (!lost_resource)
671 sync_point = gl->InsertSyncPointCHROMIUM(); 671 sync_point = gl->InsertSyncPointCHROMIUM();
672 } 672 }
673 } else { 673 } else {
674 DCHECK(resource->mailbox.IsSharedMemory()); 674 DCHECK(resource->mailbox.IsSharedMemory());
675 base::SharedMemory* shared_memory = resource->mailbox.shared_memory(); 675 base::SharedMemory* shared_memory = resource->mailbox.shared_memory();
676 if (resource->pixels && shared_memory) { 676 if (resource->pixels && shared_memory) {
677 DCHECK(shared_memory->memory() == resource->pixels); 677 DCHECK(shared_memory->memory() == resource->pixels);
678 resource->pixels = NULL; 678 resource->pixels = nullptr;
679 delete resource->shared_bitmap; 679 delete resource->shared_bitmap;
680 resource->shared_bitmap = NULL; 680 resource->shared_bitmap = nullptr;
681 } 681 }
682 } 682 }
683 resource->release_callback_impl.Run( 683 resource->release_callback_impl.Run(
684 sync_point, lost_resource, blocking_main_thread_task_runner_); 684 sync_point, lost_resource, blocking_main_thread_task_runner_);
685 } 685 }
686 if (resource->gl_id) { 686 if (resource->gl_id) {
687 GLES2Interface* gl = ContextGL(); 687 GLES2Interface* gl = ContextGL();
688 DCHECK(gl); 688 DCHECK(gl);
689 GLC(gl, gl->DeleteTextures(1, &resource->gl_id)); 689 GLC(gl, gl->DeleteTextures(1, &resource->gl_id));
690 resource->gl_id = 0; 690 resource->gl_id = 0;
691 } 691 }
692 if (resource->shared_bitmap) { 692 if (resource->shared_bitmap) {
693 DCHECK(resource->origin != Resource::External); 693 DCHECK(resource->origin != Resource::External);
694 DCHECK_EQ(Bitmap, resource->type); 694 DCHECK_EQ(Bitmap, resource->type);
695 delete resource->shared_bitmap; 695 delete resource->shared_bitmap;
696 resource->pixels = NULL; 696 resource->pixels = nullptr;
697 } 697 }
698 if (resource->pixels) { 698 if (resource->pixels) {
699 DCHECK(resource->origin == Resource::Internal); 699 DCHECK(resource->origin == Resource::Internal);
700 delete[] resource->pixels; 700 delete[] resource->pixels;
701 } 701 }
702 resources_.erase(it); 702 resources_.erase(it);
703 } 703 }
704 704
705 ResourceProvider::ResourceType ResourceProvider::GetResourceType( 705 ResourceProvider::ResourceType ResourceProvider::GetResourceType(
706 ResourceId id) { 706 ResourceId id) {
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 GLES2Interface* gl = ContextGL(); 1655 GLES2Interface* gl = ContextGL();
1656 DCHECK(gl); 1656 DCHECK(gl);
1657 if (!resource->gl_pixel_buffer_id) 1657 if (!resource->gl_pixel_buffer_id)
1658 resource->gl_pixel_buffer_id = buffer_id_allocator_->NextId(); 1658 resource->gl_pixel_buffer_id = buffer_id_allocator_->NextId();
1659 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 1659 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
1660 resource->gl_pixel_buffer_id); 1660 resource->gl_pixel_buffer_id);
1661 unsigned bytes_per_pixel = BitsPerPixel(resource->format) / 8; 1661 unsigned bytes_per_pixel = BitsPerPixel(resource->format) / 8;
1662 gl->BufferData(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 1662 gl->BufferData(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
1663 resource->size.height() * 1663 resource->size.height() *
1664 RoundUp(bytes_per_pixel * resource->size.width(), 4u), 1664 RoundUp(bytes_per_pixel * resource->size.width(), 4u),
1665 NULL, 1665 nullptr,
1666 GL_DYNAMIC_DRAW); 1666 GL_DYNAMIC_DRAW);
1667 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); 1667 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0);
1668 } 1668 }
1669 1669
1670 void ResourceProvider::ReleasePixelBuffer(ResourceId id) { 1670 void ResourceProvider::ReleasePixelBuffer(ResourceId id) {
1671 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 1671 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
1672 "ResourceProvider::ReleasePixelBuffer"); 1672 "ResourceProvider::ReleasePixelBuffer");
1673 1673
1674 Resource* resource = GetResource(id); 1674 Resource* resource = GetResource(id);
1675 DCHECK(resource->origin == Resource::Internal); 1675 DCHECK(resource->origin == Resource::Internal);
(...skipping 13 matching lines...) Expand all
1689 } 1689 }
1690 1690
1691 DCHECK_EQ(GLTexture, resource->type); 1691 DCHECK_EQ(GLTexture, resource->type);
1692 if (!resource->gl_pixel_buffer_id) 1692 if (!resource->gl_pixel_buffer_id)
1693 return; 1693 return;
1694 GLES2Interface* gl = ContextGL(); 1694 GLES2Interface* gl = ContextGL();
1695 DCHECK(gl); 1695 DCHECK(gl);
1696 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 1696 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
1697 resource->gl_pixel_buffer_id); 1697 resource->gl_pixel_buffer_id);
1698 gl->BufferData( 1698 gl->BufferData(
1699 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0, NULL, GL_DYNAMIC_DRAW); 1699 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0, nullptr, GL_DYNAMIC_DRAW);
1700 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); 1700 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0);
1701 } 1701 }
1702 1702
1703 uint8_t* ResourceProvider::MapPixelBuffer(ResourceId id, int* stride) { 1703 uint8_t* ResourceProvider::MapPixelBuffer(ResourceId id, int* stride) {
1704 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 1704 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
1705 "ResourceProvider::MapPixelBuffer"); 1705 "ResourceProvider::MapPixelBuffer");
1706 1706
1707 Resource* resource = GetResource(id); 1707 Resource* resource = GetResource(id);
1708 DCHECK(resource->origin == Resource::Internal); 1708 DCHECK(resource->origin == Resource::Internal);
1709 DCHECK_EQ(resource->exported_count, 0); 1709 DCHECK_EQ(resource->exported_count, 0);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 resource->gl_upload_query_id); 1801 resource->gl_upload_query_id);
1802 if (allocate) { 1802 if (allocate) {
1803 gl->AsyncTexImage2DCHROMIUM(GL_TEXTURE_2D, 1803 gl->AsyncTexImage2DCHROMIUM(GL_TEXTURE_2D,
1804 0, /* level */ 1804 0, /* level */
1805 GLInternalFormat(resource->format), 1805 GLInternalFormat(resource->format),
1806 resource->size.width(), 1806 resource->size.width(),
1807 resource->size.height(), 1807 resource->size.height(),
1808 0, /* border */ 1808 0, /* border */
1809 GLDataFormat(resource->format), 1809 GLDataFormat(resource->format),
1810 GLDataType(resource->format), 1810 GLDataType(resource->format),
1811 NULL); 1811 nullptr);
1812 } else { 1812 } else {
1813 gl->AsyncTexSubImage2DCHROMIUM(GL_TEXTURE_2D, 1813 gl->AsyncTexSubImage2DCHROMIUM(GL_TEXTURE_2D,
1814 0, /* level */ 1814 0, /* level */
1815 0, /* x */ 1815 0, /* x */
1816 0, /* y */ 1816 0, /* y */
1817 resource->size.width(), 1817 resource->size.width(),
1818 resource->size.height(), 1818 resource->size.height(),
1819 GLDataFormat(resource->format), 1819 GLDataFormat(resource->format),
1820 GLDataType(resource->format), 1820 GLDataType(resource->format),
1821 NULL); 1821 nullptr);
1822 } 1822 }
1823 gl->EndQueryEXT(GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM); 1823 gl->EndQueryEXT(GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM);
1824 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); 1824 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0);
1825 1825
1826 resource->pending_set_pixels = true; 1826 resource->pending_set_pixels = true;
1827 resource->set_pixels_completion_forced = false; 1827 resource->set_pixels_completion_forced = false;
1828 } 1828 }
1829 1829
1830 void ResourceProvider::ForceSetPixelsToComplete(ResourceId id) { 1830 void ResourceProvider::ForceSetPixelsToComplete(ResourceId id) {
1831 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 1831 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 if (format != ETC1) { 1956 if (format != ETC1) {
1957 GLC(gl, 1957 GLC(gl,
1958 gl->TexImage2D(GL_TEXTURE_2D, 1958 gl->TexImage2D(GL_TEXTURE_2D,
1959 0, 1959 0,
1960 GLInternalFormat(format), 1960 GLInternalFormat(format),
1961 size.width(), 1961 size.width(),
1962 size.height(), 1962 size.height(),
1963 0, 1963 0,
1964 GLDataFormat(format), 1964 GLDataFormat(format),
1965 GLDataType(format), 1965 GLDataType(format),
1966 NULL)); 1966 nullptr));
1967 } 1967 }
1968 } 1968 }
1969 } 1969 }
1970 1970
1971 void ResourceProvider::BindImageForSampling(Resource* resource) { 1971 void ResourceProvider::BindImageForSampling(Resource* resource) {
1972 GLES2Interface* gl = ContextGL(); 1972 GLES2Interface* gl = ContextGL();
1973 DCHECK(resource->gl_id); 1973 DCHECK(resource->gl_id);
1974 DCHECK(resource->image_id); 1974 DCHECK(resource->image_id);
1975 1975
1976 // Release image currently bound to texture. 1976 // Release image currently bound to texture.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 } 2046 }
2047 2047
2048 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) { 2048 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) {
2049 GLint active_unit = 0; 2049 GLint active_unit = 0;
2050 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); 2050 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit);
2051 return active_unit; 2051 return active_unit;
2052 } 2052 }
2053 2053
2054 GLES2Interface* ResourceProvider::ContextGL() const { 2054 GLES2Interface* ResourceProvider::ContextGL() const {
2055 ContextProvider* context_provider = output_surface_->context_provider(); 2055 ContextProvider* context_provider = output_surface_->context_provider();
2056 return context_provider ? context_provider->ContextGL() : NULL; 2056 return context_provider ? context_provider->ContextGL() : nullptr;
2057 } 2057 }
2058 2058
2059 class GrContext* ResourceProvider::GrContext() const { 2059 class GrContext* ResourceProvider::GrContext() const {
2060 ContextProvider* context_provider = output_surface_->context_provider(); 2060 ContextProvider* context_provider = output_surface_->context_provider();
2061 return context_provider ? context_provider->GrContext() : NULL; 2061 return context_provider ? context_provider->GrContext() : nullptr;
2062 } 2062 }
2063 2063
2064 } // namespace cc 2064 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698