| OLD | NEW |
| 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/resource_provider.h" | 5 #include "cc/resource_provider.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 | 8 |
| 9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/string_split.h" | 12 #include "base/string_split.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "cc/ganesh_context_provider.h" |
| 14 #include "cc/gl_renderer.h" // For the GLC() macro. | 15 #include "cc/gl_renderer.h" // For the GLC() macro. |
| 15 #include "cc/platform_color.h" | 16 #include "cc/platform_color.h" |
| 16 #include "cc/texture_uploader.h" | 17 #include "cc/texture_uploader.h" |
| 17 #include "cc/transferable_resource.h" | 18 #include "cc/transferable_resource.h" |
| 18 #include "gpu/GLES2/gl2extchromium.h" | 19 #include "gpu/GLES2/gl2extchromium.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 20 #include "third_party/khronos/GLES2/gl2.h" | 21 #include "third_party/khronos/GLES2/gl2.h" |
| 21 #include "third_party/khronos/GLES2/gl2ext.h" | 22 #include "third_party/khronos/GLES2/gl2ext.h" |
| 22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
| 23 #include "ui/gfx/vector2d.h" | 24 #include "ui/gfx/vector2d.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 ResourceProvider::ResourceProvider(OutputSurface* context) | 570 ResourceProvider::ResourceProvider(OutputSurface* context) |
| 570 : m_outputSurface(context) | 571 : m_outputSurface(context) |
| 571 , m_nextId(1) | 572 , m_nextId(1) |
| 572 , m_nextChild(1) | 573 , m_nextChild(1) |
| 573 , m_defaultResourceType(GLTexture) | 574 , m_defaultResourceType(GLTexture) |
| 574 , m_useTextureStorageExt(false) | 575 , m_useTextureStorageExt(false) |
| 575 , m_useTextureUsageHint(false) | 576 , m_useTextureUsageHint(false) |
| 576 , m_useShallowFlush(false) | 577 , m_useShallowFlush(false) |
| 577 , m_maxTextureSize(0) | 578 , m_maxTextureSize(0) |
| 578 , m_bestTextureFormat(0) | 579 , m_bestTextureFormat(0) |
| 580 , m_ganeshContextProvider(GaneshContextProvider::Create()) |
| 579 { | 581 { |
| 580 } | 582 } |
| 581 | 583 |
| 582 bool ResourceProvider::initialize() | 584 bool ResourceProvider::initialize() |
| 583 { | 585 { |
| 584 DCHECK(m_threadChecker.CalledOnValidThread()); | 586 DCHECK(m_threadChecker.CalledOnValidThread()); |
| 585 WebGraphicsContext3D* context3d = m_outputSurface->Context3D(); | 587 WebGraphicsContext3D* context3d = m_outputSurface->Context3D(); |
| 586 if (!context3d) { | 588 if (!context3d) { |
| 587 m_maxTextureSize = INT_MAX / 2; | 589 m_maxTextureSize = INT_MAX / 2; |
| 588 m_bestTextureFormat = GL_RGBA; | 590 m_bestTextureFormat = GL_RGBA; |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 } | 1079 } |
| 1078 | 1080 |
| 1079 void ResourceProvider::enableReadLockFences(ResourceProvider::ResourceId id, boo
l enable) { | 1081 void ResourceProvider::enableReadLockFences(ResourceProvider::ResourceId id, boo
l enable) { |
| 1080 DCHECK(m_threadChecker.CalledOnValidThread()); | 1082 DCHECK(m_threadChecker.CalledOnValidThread()); |
| 1081 ResourceMap::iterator it = m_resources.find(id); | 1083 ResourceMap::iterator it = m_resources.find(id); |
| 1082 CHECK(it != m_resources.end()); | 1084 CHECK(it != m_resources.end()); |
| 1083 Resource* resource = &it->second; | 1085 Resource* resource = &it->second; |
| 1084 resource->enableReadLockFences = enable; | 1086 resource->enableReadLockFences = enable; |
| 1085 } | 1087 } |
| 1086 | 1088 |
| 1089 void ResourceProvider::setGaneshContexts(WebKit::WebGraphicsContext3D* context3d
, GrContext* grContext) { |
| 1090 m_ganeshContextProvider->set_contexts(context3d, grContext); |
| 1091 } |
| 1092 |
| 1087 } // namespace cc | 1093 } // namespace cc |
| OLD | NEW |