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

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: Put OffscreenContext class in content/common/gpu/client for renderer 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/switches.h" 13 #include "cc/switches.h"
14 #include "cc/thread.h" 14 #include "cc/thread.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
20 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h "
21 #include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsCo ntext3D.h"
21 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 22 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
22 #include "web_layer_impl.h" 23 #include "web_layer_impl.h"
23 #include "web_to_ccinput_handler_adapter.h" 24 #include "web_to_ccinput_handler_adapter.h"
24 #include "webkit/compositor_bindings/web_rendering_stats_impl.h" 25 #include "webkit/compositor_bindings/web_rendering_stats_impl.h"
25 26
26 using namespace cc; 27 using namespace cc;
27 28
28 namespace WebKit { 29 namespace WebKit {
29 30
30 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) 31 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client)
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 { 276 {
276 WebKit::WebCompositorOutputSurface* web = m_client->createOutputSurface(); 277 WebKit::WebCompositorOutputSurface* web = m_client->createOutputSurface();
277 return make_scoped_ptr(static_cast<cc::OutputSurface*>(web)); 278 return make_scoped_ptr(static_cast<cc::OutputSurface*>(web));
278 } 279 }
279 280
280 void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) 281 void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success)
281 { 282 {
282 m_client->didRecreateOutputSurface(success); 283 m_client->didRecreateOutputSurface(success);
283 } 284 }
284 285
286 WebKit::WebGraphicsContext3D* WebLayerTreeViewImpl::offscreenContext3dForMainThr ead()
287 {
288 return WebSharedGraphicsContext3D::mainThreadContext();
289 }
290
291 WebKit::WebGraphicsContext3D* WebLayerTreeViewImpl::offscreenContext3dForComposi torThread()
292 {
293 if (!WebSharedGraphicsContext3D::haveCompositorThreadContext() && !WebShared GraphicsContext3D::createCompositorThreadContext())
294 return NULL;
295 return WebSharedGraphicsContext3D::compositorThreadContext();
296 }
297
298 GrContext* WebLayerTreeViewImpl::offscreenGrContextForMainThread()
299 {
300 return WebSharedGraphicsContext3D::mainThreadGrContext();
301 }
302
303 GrContext* WebLayerTreeViewImpl::offscreenGrContextForCompositorThread()
304 {
305 return WebSharedGraphicsContext3D::compositorThreadGrContext();
306 }
307
285 scoped_ptr<InputHandler> WebLayerTreeViewImpl::createInputHandler() 308 scoped_ptr<InputHandler> WebLayerTreeViewImpl::createInputHandler()
286 { 309 {
287 scoped_ptr<InputHandler> ret; 310 scoped_ptr<InputHandler> ret;
288 scoped_ptr<WebInputHandler> handler(m_client->createInputHandler()); 311 scoped_ptr<WebInputHandler> handler(m_client->createInputHandler());
289 if (handler) 312 if (handler)
290 ret = WebToCCInputHandlerAdapter::create(handler.Pass()); 313 ret = WebToCCInputHandlerAdapter::create(handler.Pass());
291 return ret.Pass(); 314 return ret.Pass();
292 } 315 }
293 316
294 void WebLayerTreeViewImpl::willCommit() 317 void WebLayerTreeViewImpl::willCommit()
(...skipping 15 matching lines...) Expand all
310 { 333 {
311 m_client->didCompleteSwapBuffers(); 334 m_client->didCompleteSwapBuffers();
312 } 335 }
313 336
314 void WebLayerTreeViewImpl::scheduleComposite() 337 void WebLayerTreeViewImpl::scheduleComposite()
315 { 338 {
316 m_client->scheduleComposite(); 339 m_client->scheduleComposite();
317 } 340 }
318 341
319 } // namespace WebKit 342 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698