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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 14772021: cc::OutputSurfaceClient::InitializeForGL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanups Created 7 years, 7 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 "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 1415
1416 // Note: order is important here. 1416 // Note: order is important here.
1417 renderer_.reset(); 1417 renderer_.reset();
1418 tile_manager_.reset(); 1418 tile_manager_.reset();
1419 resource_provider_.reset(); 1419 resource_provider_.reset();
1420 output_surface_.reset(); 1420 output_surface_.reset();
1421 1421
1422 if (!output_surface->BindToClient(this)) 1422 if (!output_surface->BindToClient(this))
1423 return false; 1423 return false;
1424 1424
1425 if (output_surface->capabilities().deferred_gl_initialization) { 1425 return DoInitializeRenderer(output_surface.Pass(),
1426 false /* is_deffered_init */);
1427 }
1428
1429 bool LayerTreeHostImpl::DoInitializeRenderer(
1430 scoped_ptr<OutputSurface> output_surface,
1431 bool is_deffered_init) {
1432 if (output_surface->capabilities().deferred_gl_initialization &&
1433 !is_deffered_init) {
1426 // TODO(joth): Defer creating the Renderer too, until GL is initialized. 1434 // TODO(joth): Defer creating the Renderer too, until GL is initialized.
1427 // See http://crbug.com/230197 1435 // See http://crbug.com/230197
1428 renderer_ = SoftwareRenderer::Create(this, output_surface.get(), NULL); 1436 renderer_ = SoftwareRenderer::Create(this, output_surface.get(), NULL);
piman 2013/05/28 23:35:34 I wasn't involved in the original CL, but like Dan
1429 } else { 1437 } else {
1430 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( 1438 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create(
1431 output_surface.get(), settings_.highp_threshold_min); 1439 output_surface.get(), settings_.highp_threshold_min);
1432 if (!resource_provider) 1440 if (!resource_provider)
1433 return false; 1441 return false;
1434 1442
1435 if (output_surface->capabilities().has_parent_compositor) { 1443 if (output_surface->capabilities().has_parent_compositor) {
1436 renderer_ = DelegatingRenderer::Create(this, output_surface.get(), 1444 renderer_ = DelegatingRenderer::Create(this, output_surface.get(),
1437 resource_provider.get()); 1445 resource_provider.get());
1438 } else if (output_surface->context3d()) { 1446 } else if (output_surface->context3d()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 1480
1473 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs 1481 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs
1474 // to be initialized to get max texture size. 1482 // to be initialized to get max texture size.
1475 active_tree_->set_needs_update_draw_properties(); 1483 active_tree_->set_needs_update_draw_properties();
1476 if (pending_tree_) 1484 if (pending_tree_)
1477 pending_tree_->set_needs_update_draw_properties(); 1485 pending_tree_->set_needs_update_draw_properties();
1478 1486
1479 return true; 1487 return true;
1480 } 1488 }
1481 1489
1490 bool LayerTreeHostImpl::InitializeForGL(
1491 scoped_refptr<ContextProvider> offscreen_context_provider) {
1492 DCHECK(output_surface_->capabilities().deferred_gl_initialization);
1493 DCHECK(output_surface_->context3d());
1494 bool success =
1495 DoInitializeRenderer(output_surface_.Pass(), true /* is_deffered_init */);
1496 client_->DidTryInitializeRendererOnImplThread(success,
1497 offscreen_context_provider);
1498 return success;
1499 }
1500
1482 void LayerTreeHostImpl::SetViewportSize(gfx::Size device_viewport_size) { 1501 void LayerTreeHostImpl::SetViewportSize(gfx::Size device_viewport_size) {
1483 if (device_viewport_size == device_viewport_size_) 1502 if (device_viewport_size == device_viewport_size_)
1484 return; 1503 return;
1485 1504
1486 if (pending_tree_ && device_viewport_size_ != device_viewport_size) 1505 if (pending_tree_ && device_viewport_size_ != device_viewport_size)
1487 active_tree_->SetViewportSizeInvalid(); 1506 active_tree_->SetViewportSizeInvalid();
1488 1507
1489 device_viewport_size_ = device_viewport_size; 1508 device_viewport_size_ = device_viewport_size;
1490 1509
1491 UpdateMaxScrollOffset(); 1510 UpdateMaxScrollOffset();
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 } 2254 }
2236 2255
2237 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { 2256 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
2238 if (debug_state_.continuous_painting != debug_state.continuous_painting) 2257 if (debug_state_.continuous_painting != debug_state.continuous_painting)
2239 paint_time_counter_->ClearHistory(); 2258 paint_time_counter_->ClearHistory();
2240 2259
2241 debug_state_ = debug_state; 2260 debug_state_ = debug_state;
2242 } 2261 }
2243 2262
2244 } // namespace cc 2263 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698