| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor/delegated_frame_host.h" | 5 #include "content/browser/compositor/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
| 11 #include "cc/output/copy_output_request.h" | 11 #include "cc/output/copy_output_request.h" |
| 12 #include "cc/resources/single_release_callback.h" | 12 #include "cc/resources/single_release_callback.h" |
| 13 #include "cc/resources/texture_mailbox.h" | 13 #include "cc/resources/texture_mailbox.h" |
| 14 #include "cc/surfaces/surface.h" | 14 #include "cc/surfaces/surface.h" |
| 15 #include "cc/surfaces/surface_factory.h" | 15 #include "cc/surfaces/surface_factory.h" |
| 16 #include "cc/surfaces/surface_manager.h" | 16 #include "cc/surfaces/surface_manager.h" |
| 17 #include "content/browser/compositor/resize_lock.h" | 17 #include "content/browser/compositor/resize_lock.h" |
| 18 #include "content/browser/gpu/compositor_util.h" | 18 #include "content/browser/gpu/compositor_util.h" |
| 19 #include "content/common/gpu/client/gl_helper.h" | 19 #include "content/common/gpu/client/gl_helper.h" |
| 20 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 20 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "media/base/video_frame.h" | 22 #include "media/base/video_frame.h" |
| 23 #include "media/base/video_util.h" | 23 #include "media/base/video_util.h" |
| 24 #include "skia/ext/image_operations.h" | 24 #include "skia/ext/image_operations.h" |
| 25 #include "third_party/skia/include/core/SkCanvas.h" | 25 #include "third_party/skia/include/core/SkCanvas.h" |
| 26 #include "third_party/skia/include/core/SkPaint.h" | 26 #include "third_party/skia/include/core/SkPaint.h" |
| 27 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 27 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
| 28 #include "ui/gfx/frame_time.h" | 28 #include "ui/gfx/frame_time.h" |
| 29 #include "ui/gfx/geometry/dip_util.h" |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 void SatisfyCallback(cc::SurfaceManager* manager, | 35 void SatisfyCallback(cc::SurfaceManager* manager, |
| 35 cc::SurfaceSequence sequence) { | 36 cc::SurfaceSequence sequence) { |
| 36 std::vector<uint32_t> sequences; | 37 std::vector<uint32_t> sequences; |
| 37 sequences.push_back(sequence.sequence); | 38 sequences.push_back(sequence.sequence); |
| 38 manager->DidSatisfySequences(sequence.id_namespace, &sequences); | 39 manager->DidSatisfySequences(sequence.id_namespace, &sequences); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 scoped_ptr<cc::DelegatedFrameData> frame_data, | 319 scoped_ptr<cc::DelegatedFrameData> frame_data, |
| 319 float frame_device_scale_factor, | 320 float frame_device_scale_factor, |
| 320 const std::vector<ui::LatencyInfo>& latency_info) { | 321 const std::vector<ui::LatencyInfo>& latency_info) { |
| 321 RenderWidgetHostImpl* host = client_->GetHost(); | 322 RenderWidgetHostImpl* host = client_->GetHost(); |
| 322 DCHECK(!frame_data->render_pass_list.empty()); | 323 DCHECK(!frame_data->render_pass_list.empty()); |
| 323 | 324 |
| 324 cc::RenderPass* root_pass = frame_data->render_pass_list.back(); | 325 cc::RenderPass* root_pass = frame_data->render_pass_list.back(); |
| 325 | 326 |
| 326 gfx::Size frame_size = root_pass->output_rect.size(); | 327 gfx::Size frame_size = root_pass->output_rect.size(); |
| 327 gfx::Size frame_size_in_dip = | 328 gfx::Size frame_size_in_dip = |
| 328 ConvertSizeToDIP(frame_device_scale_factor, frame_size); | 329 gfx::ConvertSizeToDIP(frame_device_scale_factor, frame_size); |
| 329 | 330 |
| 330 gfx::Rect damage_rect = gfx::ToEnclosingRect(root_pass->damage_rect); | 331 gfx::Rect damage_rect = gfx::ToEnclosingRect(root_pass->damage_rect); |
| 331 damage_rect.Intersect(gfx::Rect(frame_size)); | 332 damage_rect.Intersect(gfx::Rect(frame_size)); |
| 332 gfx::Rect damage_rect_in_dip = | 333 gfx::Rect damage_rect_in_dip = |
| 333 ConvertRectToDIP(frame_device_scale_factor, damage_rect); | 334 gfx::ConvertRectToDIP(frame_device_scale_factor, damage_rect); |
| 334 | 335 |
| 335 if (ShouldSkipFrame(frame_size_in_dip)) { | 336 if (ShouldSkipFrame(frame_size_in_dip)) { |
| 336 cc::CompositorFrameAck ack; | 337 cc::CompositorFrameAck ack; |
| 337 cc::TransferableResource::ReturnResources(frame_data->resource_list, | 338 cc::TransferableResource::ReturnResources(frame_data->resource_list, |
| 338 &ack.resources); | 339 &ack.resources); |
| 339 | 340 |
| 340 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), | 341 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), |
| 341 latency_info.begin(), latency_info.end()); | 342 latency_info.begin(), latency_info.end()); |
| 342 | 343 |
| 343 RenderWidgetHostImpl::SendSwapCompositorFrameAck( | 344 RenderWidgetHostImpl::SendSwapCompositorFrameAck( |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 1017 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 1017 new_layer->SetShowSurface( | 1018 new_layer->SetShowSurface( |
| 1018 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 1019 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 1019 base::Bind(&RequireCallback, base::Unretained(manager)), | 1020 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 1020 current_surface_size_, current_scale_factor_, | 1021 current_surface_size_, current_scale_factor_, |
| 1021 current_frame_size_in_dip_); | 1022 current_frame_size_in_dip_); |
| 1022 } | 1023 } |
| 1023 } | 1024 } |
| 1024 | 1025 |
| 1025 } // namespace content | 1026 } // namespace content |
| OLD | NEW |