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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 26023004: aura: Allow delegated frames to be used by more than one impl layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: frameprovider: nits Created 7 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "cc/layers/delegated_frame_provider.h"
15 #include "cc/output/compositor_frame.h" 16 #include "cc/output/compositor_frame.h"
16 #include "cc/output/compositor_frame_ack.h" 17 #include "cc/output/compositor_frame_ack.h"
17 #include "cc/output/copy_output_request.h" 18 #include "cc/output/copy_output_request.h"
18 #include "cc/output/copy_output_result.h" 19 #include "cc/output/copy_output_result.h"
19 #include "cc/resources/texture_mailbox.h" 20 #include "cc/resources/texture_mailbox.h"
20 #include "cc/trees/layer_tree_settings.h" 21 #include "cc/trees/layer_tree_settings.h"
21 #include "content/browser/accessibility/browser_accessibility_manager.h" 22 #include "content/browser/accessibility/browser_accessibility_manager.h"
22 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 23 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
23 #include "content/browser/aura/compositor_resize_lock.h" 24 #include "content/browser/aura/compositor_resize_lock.h"
24 #include "content/browser/gpu/compositor_util.h" 25 #include "content/browser/gpu/compositor_util.h"
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 } 1464 }
1464 1465
1465 if (output_surface_id != last_output_surface_id_) { 1466 if (output_surface_id != last_output_surface_id_) {
1466 // Resource ids are scoped by the output surface. 1467 // Resource ids are scoped by the output surface.
1467 // If the originating output surface doesn't match the last one, it 1468 // If the originating output surface doesn't match the last one, it
1468 // indicates the renderer's output surface may have been recreated, in which 1469 // indicates the renderer's output surface may have been recreated, in which
1469 // case we should recreate the DelegatedRendererLayer, to avoid matching 1470 // case we should recreate the DelegatedRendererLayer, to avoid matching
1470 // resources from the old one with resources from the new one which would 1471 // resources from the old one with resources from the new one which would
1471 // have the same id. Changing the layer to showing painted content destroys 1472 // have the same id. Changing the layer to showing painted content destroys
1472 // the DelegatedRendererLayer. 1473 // the DelegatedRendererLayer.
1473 // TODO(danakj): Lose and return all resources in the delegated layer first.
1474 window_->layer()->SetShowPaintedContent(); 1474 window_->layer()->SetShowPaintedContent();
1475
1476 // TODO(danakj): Lose all resources and send them back here, such as:
1477 // resource_collection_->LoseAllResources();
1478 // SendReturnedDelegatedResources(last_output_surface_id_);
1479
1480 // Drop the cc::DelegatedFrameResourceCollection so that we will not return
1481 // any resources from the old output surface with the new output surface id.
piman 2013/10/04 23:42:25 I wonder if we should have the DelegatedFrameResou
danakj 2013/10/07 21:57:39 Hm, if I'm understanding your suggestion, we'll ha
piman 2013/10/08 03:38:08 Ok. The thing I'm kinda worried is below in SendDe
1482 frame_provider_.reset();
1483 resource_collection_.reset();
1475 last_output_surface_id_ = output_surface_id; 1484 last_output_surface_id_ = output_surface_id;
1476 } 1485 }
1477 if (frame_size.IsEmpty()) { 1486 if (frame_size.IsEmpty()) {
1478 // TODO(danakj): Return all resources in the delegated layer somehow. 1487 DCHECK_EQ(0u, frame_data->resource_list.size());
1479 window_->layer()->SetShowPaintedContent(); 1488 window_->layer()->SetShowPaintedContent();
1480 } else { 1489 } else {
1481 window_->layer()->SetDelegatedFrame(frame_data.Pass(), frame_size_in_dip); 1490 if (!resource_collection_)
piman 2013/10/04 23:42:25 nit: needs {}
danakj 2013/10/07 21:57:39 Done.
1491 resource_collection_.reset(
1492 new cc::DelegatedFrameResourceCollection(this));
1493 if (!frame_provider_ || frame_size != frame_provider_->frame_size()) {
1494 frame_provider_.reset(new cc::DelegatedFrameProvider(
1495 resource_collection_.get(), frame_data.Pass()));
1496 window_->layer()->SetShowDelegatedContent(frame_provider_.get(),
1497 frame_size_in_dip);
1498 } else {
1499 frame_provider_->SetFrameData(frame_data.Pass());
1500 }
1482 } 1501 }
1483 released_front_lock_ = NULL; 1502 released_front_lock_ = NULL;
1484 current_frame_size_ = frame_size_in_dip; 1503 current_frame_size_ = frame_size_in_dip;
1485 CheckResizeLock(); 1504 CheckResizeLock();
1486 1505
1487 if (paint_observer_) 1506 if (paint_observer_)
1488 paint_observer_->OnUpdateCompositorContent(); 1507 paint_observer_->OnUpdateCompositorContent();
1489 window_->SchedulePaintInRect(damage_rect_in_dip); 1508 window_->SchedulePaintInRect(damage_rect_in_dip);
1490 1509
1491 ui::Compositor* compositor = GetCompositor(); 1510 ui::Compositor* compositor = GetCompositor();
1492 if (!compositor) { 1511 if (!compositor) {
1493 SendDelegatedFrameAck(output_surface_id); 1512 SendDelegatedFrameAck(output_surface_id);
1494 } else { 1513 } else {
1495 compositor->SetLatencyInfo(latency_info); 1514 compositor->SetLatencyInfo(latency_info);
1496 AddOnCommitCallbackAndDisableLocks( 1515 AddOnCommitCallbackAndDisableLocks(
1497 base::Bind(&RenderWidgetHostViewAura::SendDelegatedFrameAck, 1516 base::Bind(&RenderWidgetHostViewAura::SendDelegatedFrameAck,
1498 AsWeakPtr(), 1517 AsWeakPtr(),
1499 output_surface_id)); 1518 output_surface_id));
1500 } 1519 }
1501 DidReceiveFrameFromRenderer(); 1520 DidReceiveFrameFromRenderer();
1502 } 1521 }
1503 1522
1504 void RenderWidgetHostViewAura::SendDelegatedFrameAck(uint32 output_surface_id) { 1523 void RenderWidgetHostViewAura::SendDelegatedFrameAck(uint32 output_surface_id) {
1505 cc::CompositorFrameAck ack; 1524 cc::CompositorFrameAck ack;
1506 window_->layer()->TakeUnusedResourcesForChildCompositor(&ack.resources); 1525 if (resource_collection_)
1507 RenderWidgetHostImpl::SendSwapCompositorFrameAck( 1526 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources);
1508 host_->GetRoutingID(), output_surface_id, 1527 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host_->GetRoutingID(),
1509 host_->GetProcess()->GetID(), ack); 1528 output_surface_id,
1529 host_->GetProcess()->GetID(),
1530 ack);
1531 }
1532
1533 void RenderWidgetHostViewAura::UnusedResourcesAreAvailable() {
1534 // TODO(danakj): If no ack is pending, collect and send resources now.
1510 } 1535 }
1511 1536
1512 void RenderWidgetHostViewAura::SwapSoftwareFrame( 1537 void RenderWidgetHostViewAura::SwapSoftwareFrame(
1513 uint32 output_surface_id, 1538 uint32 output_surface_id,
1514 scoped_ptr<cc::SoftwareFrameData> frame_data, 1539 scoped_ptr<cc::SoftwareFrameData> frame_data,
1515 float frame_device_scale_factor, 1540 float frame_device_scale_factor,
1516 const ui::LatencyInfo& latency_info) { 1541 const ui::LatencyInfo& latency_info) {
1517 const gfx::Size& frame_size = frame_data->size; 1542 const gfx::Size& frame_size = frame_data->size;
1518 const gfx::Rect& damage_rect = frame_data->damage_rect; 1543 const gfx::Rect& damage_rect = frame_data->damage_rect;
1519 gfx::Size frame_size_in_dip = 1544 gfx::Size frame_size_in_dip =
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
3387 RenderWidgetHost* widget) { 3412 RenderWidgetHost* widget) {
3388 return new RenderWidgetHostViewAura(widget); 3413 return new RenderWidgetHostViewAura(widget);
3389 } 3414 }
3390 3415
3391 // static 3416 // static
3392 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3417 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3393 GetScreenInfoForWindow(results, NULL); 3418 GetScreenInfoForWindow(results, NULL);
3394 } 3419 }
3395 3420
3396 } // namespace content 3421 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698