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

Side by Side Diff: cc/CCRendererGL.cpp

Issue 10900021: Use std::string instead of WTF::String / TextStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « cc/CCRenderSurface.cpp ('k') | cc/CCResourceProvider.cpp » ('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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #if USE(ACCELERATED_COMPOSITING) 8 #if USE(ACCELERATED_COMPOSITING)
9 #include "CCRendererGL.h" 9 #include "CCRendererGL.h"
10 10
(...skipping 11 matching lines...) Expand all
22 #include "FloatQuad.h" 22 #include "FloatQuad.h"
23 #include "GeometryBinding.h" 23 #include "GeometryBinding.h"
24 #include "GrTexture.h" 24 #include "GrTexture.h"
25 #include "NotImplemented.h" 25 #include "NotImplemented.h"
26 #include "PlatformColor.h" 26 #include "PlatformColor.h"
27 #include "SkBitmap.h" 27 #include "SkBitmap.h"
28 #include "SkColor.h" 28 #include "SkColor.h"
29 #include "ThrottledTextureUploader.h" 29 #include "ThrottledTextureUploader.h"
30 #include "TraceEvent.h" 30 #include "TraceEvent.h"
31 #include "UnthrottledTextureUploader.h" 31 #include "UnthrottledTextureUploader.h"
32 #ifdef LOG
33 #undef LOG
34 #endif
35 #include "base/string_split.h"
32 #include <public/WebGraphicsContext3D.h> 36 #include <public/WebGraphicsContext3D.h>
33 #include <public/WebSharedGraphicsContext3D.h> 37 #include <public/WebSharedGraphicsContext3D.h>
34 #include <public/WebVideoFrame.h> 38 #include <public/WebVideoFrame.h>
39 #include <set>
40 #include <string>
41 #include <vector>
35 #include <wtf/CurrentTime.h> 42 #include <wtf/CurrentTime.h>
36 #include <wtf/MainThread.h> 43 #include <wtf/MainThread.h>
37 #include <wtf/text/StringHash.h>
38 44
39 using namespace std; 45 using namespace std;
40 using WebKit::WebGraphicsContext3D; 46 using WebKit::WebGraphicsContext3D;
41 using WebKit::WebGraphicsMemoryAllocation; 47 using WebKit::WebGraphicsMemoryAllocation;
42 using WebKit::WebSharedGraphicsContext3D; 48 using WebKit::WebSharedGraphicsContext3D;
43 using WebKit::WebTransformationMatrix; 49 using WebKit::WebTransformationMatrix;
44 50
45 namespace WebCore { 51 namespace WebCore {
46 52
47 namespace { 53 namespace {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 89 }
84 90
85 bool CCRendererGL::initialize() 91 bool CCRendererGL::initialize()
86 { 92 {
87 if (!m_context->makeContextCurrent()) 93 if (!m_context->makeContextCurrent())
88 return false; 94 return false;
89 95
90 m_context->setContextLostCallback(this); 96 m_context->setContextLostCallback(this);
91 m_context->pushGroupMarkerEXT("CompositorContext"); 97 m_context->pushGroupMarkerEXT("CompositorContext");
92 98
93 WebKit::WebString extensionsWebString = m_context->getString(GraphicsContext 3D::EXTENSIONS); 99 std::string extensionsString = UTF16ToASCII(m_context->getString(GraphicsCon text3D::EXTENSIONS));
94 String extensionsString(extensionsWebString.data(), extensionsWebString.leng th()); 100 std::vector<std::string> extensionsList;
95 Vector<String> extensionsList; 101 base::SplitString(extensionsString, ' ', &extensionsList);
96 extensionsString.split(' ', extensionsList); 102 std::set<string> extensions(extensionsList.begin(), extensionsList.end());
97 HashSet<String> extensions;
98 for (size_t i = 0; i < extensionsList.size(); ++i)
99 extensions.add(extensionsList[i]);
100 103
101 if (settings().acceleratePainting && extensions.contains("GL_EXT_texture_for mat_BGRA8888") 104 if (settings().acceleratePainting && extensions.count("GL_EXT_texture_format _BGRA8888")
102 && extensions.contains("GL_EXT_read_format _bgra")) 105 && extensions.count("GL_EXT_read_format_bg ra"))
103 m_capabilities.usingAcceleratedPainting = true; 106 m_capabilities.usingAcceleratedPainting = true;
104 else 107 else
105 m_capabilities.usingAcceleratedPainting = false; 108 m_capabilities.usingAcceleratedPainting = false;
106 109
107 110
108 m_capabilities.contextHasCachedFrontBuffer = extensions.contains("GL_CHROMIU M_front_buffer_cached"); 111 m_capabilities.contextHasCachedFrontBuffer = extensions.count("GL_CHROMIUM_f ront_buffer_cached");
109 112
110 m_capabilities.usingPartialSwap = CCSettings::partialSwapEnabled() && extens ions.contains("GL_CHROMIUM_post_sub_buffer"); 113 m_capabilities.usingPartialSwap = CCSettings::partialSwapEnabled() && extens ions.count("GL_CHROMIUM_post_sub_buffer");
111 114
112 // Use the swapBuffers callback only with the threaded proxy. 115 // Use the swapBuffers callback only with the threaded proxy.
113 if (CCProxy::hasImplThread()) 116 if (CCProxy::hasImplThread())
114 m_capabilities.usingSwapCompleteCallback = extensions.contains("GL_CHROM IUM_swapbuffers_complete_callback"); 117 m_capabilities.usingSwapCompleteCallback = extensions.count("GL_CHROMIUM _swapbuffers_complete_callback");
115 if (m_capabilities.usingSwapCompleteCallback) 118 if (m_capabilities.usingSwapCompleteCallback)
116 m_context->setSwapBuffersCompleteCallbackCHROMIUM(this); 119 m_context->setSwapBuffersCompleteCallbackCHROMIUM(this);
117 120
118 m_capabilities.usingSetVisibility = extensions.contains("GL_CHROMIUM_set_vis ibility"); 121 m_capabilities.usingSetVisibility = extensions.count("GL_CHROMIUM_set_visibi lity");
119 122
120 if (extensions.contains("GL_CHROMIUM_iosurface")) 123 if (extensions.count("GL_CHROMIUM_iosurface"))
121 ASSERT(extensions.contains("GL_ARB_texture_rectangle")); 124 ASSERT(extensions.count("GL_ARB_texture_rectangle"));
122 125
123 m_capabilities.usingGpuMemoryManager = extensions.contains("GL_CHROMIUM_gpu_ memory_manager"); 126 m_capabilities.usingGpuMemoryManager = extensions.count("GL_CHROMIUM_gpu_mem ory_manager");
124 if (m_capabilities.usingGpuMemoryManager) 127 if (m_capabilities.usingGpuMemoryManager)
125 m_context->setMemoryAllocationChangedCallbackCHROMIUM(this); 128 m_context->setMemoryAllocationChangedCallbackCHROMIUM(this);
126 129
127 m_capabilities.usingDiscardFramebuffer = extensions.contains("GL_CHROMIUM_di scard_framebuffer"); 130 m_capabilities.usingDiscardFramebuffer = extensions.count("GL_CHROMIUM_disca rd_framebuffer");
128 131
129 m_capabilities.usingEglImage = extensions.contains("GL_OES_EGL_image_externa l"); 132 m_capabilities.usingEglImage = extensions.count("GL_OES_EGL_image_external") ;
130 133
131 GLC(m_context, m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, & m_capabilities.maxTextureSize)); 134 GLC(m_context, m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, & m_capabilities.maxTextureSize));
132 m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_contex t, extensions.contains("GL_EXT_texture_format_BGRA8888")); 135 m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_contex t, extensions.count("GL_EXT_texture_format_BGRA8888"));
133 136
134 m_isUsingBindUniform = extensions.contains("GL_CHROMIUM_bind_uniform_locatio n"); 137 m_isUsingBindUniform = extensions.count("GL_CHROMIUM_bind_uniform_location") ;
135 138
136 if (!initializeSharedObjects()) 139 if (!initializeSharedObjects())
137 return false; 140 return false;
138 141
139 // Make sure the viewport and context gets initialized, even if it is to zer o. 142 // Make sure the viewport and context gets initialized, even if it is to zer o.
140 viewportChanged(); 143 viewportChanged();
141 return true; 144 return true;
142 } 145 }
143 146
144 CCRendererGL::~CCRendererGL() 147 CCRendererGL::~CCRendererGL()
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 } 1503 }
1501 1504
1502 bool CCRendererGL::isContextLost() 1505 bool CCRendererGL::isContextLost()
1503 { 1506 {
1504 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO R); 1507 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO R);
1505 } 1508 }
1506 1509
1507 } // namespace WebCore 1510 } // namespace WebCore
1508 1511
1509 #endif // USE(ACCELERATED_COMPOSITING) 1512 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCRenderSurface.cpp ('k') | cc/CCResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698