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

Side by Side Diff: webkit/compositor_bindings/web_layer_tree_view_impl.cc

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the GrContextProvider::ScopedContexts guard classes Created 7 years, 10 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "web_layer_tree_view_impl.h" 5 #include "web_layer_tree_view_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "cc/font_atlas.h" 9 #include "cc/font_atlas.h"
10 #include "cc/input_handler.h" 10 #include "cc/input_handler.h"
11 #include "cc/layer.h" 11 #include "cc/layer.h"
12 #include "cc/layer_tree_host.h" 12 #include "cc/layer_tree_host.h"
13 #include "cc/thread.h" 13 #include "cc/thread.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h"
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h "
20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsCo ntext3D.h"
20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
21 #include "web_layer_impl.h" 22 #include "web_layer_impl.h"
22 #include "web_to_ccinput_handler_adapter.h" 23 #include "web_to_ccinput_handler_adapter.h"
23 #include "webkit/compositor_bindings/web_rendering_stats_impl.h" 24 #include "webkit/compositor_bindings/web_rendering_stats_impl.h"
24 25
25 using namespace cc; 26 using namespace cc;
26 27
27 namespace WebKit { 28 namespace WebKit {
28 29
29 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) 30 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client)
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 { 259 {
259 WebKit::WebCompositorOutputSurface* web = m_client->createOutputSurface(); 260 WebKit::WebCompositorOutputSurface* web = m_client->createOutputSurface();
260 return make_scoped_ptr(static_cast<cc::OutputSurface*>(web)); 261 return make_scoped_ptr(static_cast<cc::OutputSurface*>(web));
261 } 262 }
262 263
263 void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) 264 void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success)
264 { 265 {
265 m_client->didRecreateOutputSurface(success); 266 m_client->didRecreateOutputSurface(success);
266 } 267 }
267 268
269 WebKit::WebGraphicsContext3D* WebLayerTreeViewImpl::OffscreenContext3dForMainThr ead()
270 {
271 return WebSharedGraphicsContext3D::mainThreadContext();
272 }
273
274 WebKit::WebGraphicsContext3D* WebLayerTreeViewImpl::OffscreenContext3dForComposi torThread()
275 {
276 if (!WebSharedGraphicsContext3D::haveCompositorThreadContext() && !WebShared GraphicsContext3D::createCompositorThreadContext())
277 return NULL;
278 return WebSharedGraphicsContext3D::compositorThreadContext();
279 }
280
281 GrContext* WebLayerTreeViewImpl::OffscreenGrContextForMainThread()
282 {
283 return WebSharedGraphicsContext3D::mainThreadGrContext();
284 }
285
286 GrContext* WebLayerTreeViewImpl::OffscreenGrContextForCompositorThread()
287 {
288 return WebSharedGraphicsContext3D::compositorThreadGrContext();
289 }
290
291 void WebLayerTreeViewImpl::DestroyOffscreenContext3dForCompositorThread() {
292 WebSharedGraphicsContext3D::createCompositorThreadContext();
293 }
294
268 scoped_ptr<InputHandler> WebLayerTreeViewImpl::createInputHandler() 295 scoped_ptr<InputHandler> WebLayerTreeViewImpl::createInputHandler()
269 { 296 {
270 scoped_ptr<InputHandler> ret; 297 scoped_ptr<InputHandler> ret;
271 scoped_ptr<WebInputHandler> handler(m_client->createInputHandler()); 298 scoped_ptr<WebInputHandler> handler(m_client->createInputHandler());
272 if (handler) 299 if (handler)
273 ret = WebToCCInputHandlerAdapter::create(handler.Pass()); 300 ret = WebToCCInputHandlerAdapter::create(handler.Pass());
274 return ret.Pass(); 301 return ret.Pass();
275 } 302 }
276 303
277 void WebLayerTreeViewImpl::willCommit() 304 void WebLayerTreeViewImpl::willCommit()
(...skipping 15 matching lines...) Expand all
293 { 320 {
294 m_client->didCompleteSwapBuffers(); 321 m_client->didCompleteSwapBuffers();
295 } 322 }
296 323
297 void WebLayerTreeViewImpl::scheduleComposite() 324 void WebLayerTreeViewImpl::scheduleComposite()
298 { 325 {
299 m_client->scheduleComposite(); 326 m_client->scheduleComposite();
300 } 327 }
301 328
302 } // namespace WebKit 329 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698