OLD | NEW |
---|---|
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 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1449 | 1449 |
1450 // Note: order is important here. | 1450 // Note: order is important here. |
1451 renderer_.reset(); | 1451 renderer_.reset(); |
1452 tile_manager_.reset(); | 1452 tile_manager_.reset(); |
1453 resource_provider_.reset(); | 1453 resource_provider_.reset(); |
1454 output_surface_.reset(); | 1454 output_surface_.reset(); |
1455 | 1455 |
1456 if (!output_surface->BindToClient(this)) | 1456 if (!output_surface->BindToClient(this)) |
1457 return false; | 1457 return false; |
1458 | 1458 |
1459 if (output_surface->capabilities().deferred_gl_initialization) { | 1459 return DoInitializeRenderer(output_surface.Pass(), |
1460 false /* is_deferred_init */); | |
1461 } | |
1462 | |
1463 bool LayerTreeHostImpl::DoInitializeRenderer( | |
1464 scoped_ptr<OutputSurface> output_surface, | |
1465 bool is_deferred_init) { | |
1466 if (output_surface->capabilities().deferred_gl_initialization && | |
1467 !is_deferred_init) { | |
1460 // TODO(joth): Defer creating the Renderer too, until GL is initialized. | 1468 // TODO(joth): Defer creating the Renderer too, until GL is initialized. |
1461 // See http://crbug.com/230197 | 1469 // See http://crbug.com/230197 |
1462 renderer_ = SoftwareRenderer::Create(this, output_surface.get(), NULL); | 1470 renderer_ = SoftwareRenderer::Create(this, output_surface.get(), NULL); |
1463 } else { | 1471 } else { |
1464 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( | 1472 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( |
1465 output_surface.get(), settings_.highp_threshold_min); | 1473 output_surface.get(), settings_.highp_threshold_min); |
1466 if (!resource_provider) | 1474 if (!resource_provider) |
1467 return false; | 1475 return false; |
1468 | 1476 |
1469 if (output_surface->capabilities().has_parent_compositor) { | 1477 if (output_surface->capabilities().has_parent_compositor) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1506 | 1514 |
1507 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs | 1515 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs |
1508 // to be initialized to get max texture size. | 1516 // to be initialized to get max texture size. |
1509 active_tree_->set_needs_update_draw_properties(); | 1517 active_tree_->set_needs_update_draw_properties(); |
1510 if (pending_tree_) | 1518 if (pending_tree_) |
1511 pending_tree_->set_needs_update_draw_properties(); | 1519 pending_tree_->set_needs_update_draw_properties(); |
1512 | 1520 |
1513 return true; | 1521 return true; |
1514 } | 1522 } |
1515 | 1523 |
1524 bool LayerTreeHostImpl::DeferredInitialize( | |
1525 scoped_refptr<ContextProvider> offscreen_context_provider) { | |
1526 DCHECK(output_surface_->capabilities().deferred_gl_initialization); | |
1527 DCHECK(output_surface_->context3d()); | |
1528 | |
1529 // TODO(boliu): This is temporary until proper resource clean up is possible | |
1530 // without resetting |tile_manager_| or |resource_provider_|. | |
1531 DCHECK(!resource_provider_); | |
1532 | |
1533 bool success = | |
1534 DoInitializeRenderer(output_surface_.Pass(), true /* is_deferred_init */); | |
1535 client_->DidTryInitializeRendererOnImplThread(success, | |
1536 offscreen_context_provider); | |
1537 return success; | |
danakj
2013/06/05 21:53:32
AIUI, the output surface will never have an offscr
boliu
2013/06/05 22:17:27
If the offscreen context is the only thing for thi
| |
1538 } | |
1539 | |
1516 void LayerTreeHostImpl::SetViewportSize(gfx::Size device_viewport_size) { | 1540 void LayerTreeHostImpl::SetViewportSize(gfx::Size device_viewport_size) { |
1517 if (device_viewport_size == device_viewport_size_) | 1541 if (device_viewport_size == device_viewport_size_) |
1518 return; | 1542 return; |
1519 | 1543 |
1520 if (pending_tree_ && device_viewport_size_ != device_viewport_size) | 1544 if (pending_tree_ && device_viewport_size_ != device_viewport_size) |
1521 active_tree_->SetViewportSizeInvalid(); | 1545 active_tree_->SetViewportSizeInvalid(); |
1522 | 1546 |
1523 device_viewport_size_ = device_viewport_size; | 1547 device_viewport_size_ = device_viewport_size; |
1524 | 1548 |
1525 UpdateMaxScrollOffset(); | 1549 UpdateMaxScrollOffset(); |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2272 } | 2296 } |
2273 | 2297 |
2274 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2298 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2275 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2299 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2276 paint_time_counter_->ClearHistory(); | 2300 paint_time_counter_->ClearHistory(); |
2277 | 2301 |
2278 debug_state_ = debug_state; | 2302 debug_state_ = debug_state; |
2279 } | 2303 } |
2280 | 2304 |
2281 } // namespace cc | 2305 } // namespace cc |
OLD | NEW |