| 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/renderer_host/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/time/default_tick_clock.h" | 15 #include "base/time/default_tick_clock.h" |
| 16 #include "cc/base/switches.h" | 16 #include "cc/base/switches.h" |
| 17 #include "cc/output/compositor_frame.h" | 17 #include "cc/output/compositor_frame.h" |
| 18 #include "cc/output/copy_output_request.h" | 18 #include "cc/output/copy_output_request.h" |
| 19 #include "cc/resources/single_release_callback.h" | 19 #include "cc/resources/single_release_callback.h" |
| 20 #include "cc/resources/texture_mailbox.h" | 20 #include "cc/resources/texture_mailbox.h" |
| 21 #include "cc/surfaces/surface.h" | 21 #include "cc/surfaces/surface.h" |
| 22 #include "cc/surfaces/surface_factory.h" | 22 #include "cc/surfaces/surface_factory.h" |
| 23 #include "cc/surfaces/surface_hittest.h" | 23 #include "cc/surfaces/surface_hittest.h" |
| 24 #include "cc/surfaces/surface_manager.h" | 24 #include "cc/surfaces/surface_manager.h" |
| 25 #include "components/display_compositor/gl_helper.h" | 25 #include "components/display_compositor/gl_helper.h" |
| 26 #include "content/browser/compositor/surface_utils.h" | 26 #include "content/browser/compositor/surface_utils.h" |
| 27 #include "content/browser/gpu/compositor_util.h" | 27 #include "content/browser/gpu/compositor_util.h" |
| 28 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber
.h" |
| 28 #include "content/browser/renderer_host/resize_lock.h" | 29 #include "content/browser/renderer_host/resize_lock.h" |
| 29 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | |
| 30 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 31 #include "media/base/video_frame.h" | 31 #include "media/base/video_frame.h" |
| 32 #include "media/base/video_util.h" | 32 #include "media/base/video_util.h" |
| 33 #include "skia/ext/image_operations.h" | 33 #include "skia/ext/image_operations.h" |
| 34 #include "third_party/skia/include/core/SkCanvas.h" | 34 #include "third_party/skia/include/core/SkCanvas.h" |
| 35 #include "third_party/skia/include/core/SkPaint.h" | 35 #include "third_party/skia/include/core/SkPaint.h" |
| 36 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 36 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
| 37 #include "ui/gfx/geometry/dip_util.h" | 37 #include "ui/gfx/geometry/dip_util.h" |
| 38 | 38 |
| 39 namespace content { | 39 namespace content { |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 cc::CopyOutputRequest::CreateRequest(base::Bind( | 357 cc::CopyOutputRequest::CreateRequest(base::Bind( |
| 358 &DelegatedFrameHost::CopyFromCompositingSurfaceHasResultForVideo, | 358 &DelegatedFrameHost::CopyFromCompositingSurfaceHasResultForVideo, |
| 359 AsWeakPtr(), subscriber_texture, frame, | 359 AsWeakPtr(), subscriber_texture, frame, |
| 360 base::Bind(callback, present_time))); | 360 base::Bind(callback, present_time))); |
| 361 // Setting the source in this copy request asks that the layer abort any prior | 361 // Setting the source in this copy request asks that the layer abort any prior |
| 362 // uncommitted copy requests made on behalf of the same frame subscriber. | 362 // uncommitted copy requests made on behalf of the same frame subscriber. |
| 363 // This will not affect any of the copy requests spawned elsewhere from | 363 // This will not affect any of the copy requests spawned elsewhere from |
| 364 // DelegatedFrameHost (e.g., a call to CopyFromCompositingSurface() for | 364 // DelegatedFrameHost (e.g., a call to CopyFromCompositingSurface() for |
| 365 // screenshots) since those copy requests do not specify |frame_subscriber()| | 365 // screenshots) since those copy requests do not specify |frame_subscriber()| |
| 366 // as a source. | 366 // as a source. |
| 367 request->set_source(frame_subscriber()); | 367 request->set_source(frame_subscriber()->GetSourceIdForCopyRequest()); |
| 368 if (subscriber_texture.get()) { | 368 if (subscriber_texture.get()) { |
| 369 request->SetTextureMailbox(cc::TextureMailbox( | 369 request->SetTextureMailbox(cc::TextureMailbox( |
| 370 subscriber_texture->mailbox(), subscriber_texture->sync_token(), | 370 subscriber_texture->mailbox(), subscriber_texture->sync_token(), |
| 371 subscriber_texture->target())); | 371 subscriber_texture->target())); |
| 372 } | 372 } |
| 373 | 373 |
| 374 if (local_surface_id_.is_valid()) { | 374 if (local_surface_id_.is_valid()) { |
| 375 // To avoid unnecessary composites, go directly to the Surface rather than | 375 // To avoid unnecessary composites, go directly to the Surface rather than |
| 376 // through RequestCopyOfOutput (which goes through the browser | 376 // through RequestCopyOfOutput (which goes through the browser |
| 377 // compositor). | 377 // compositor). |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 std::move(request)); | 868 std::move(request)); |
| 869 } | 869 } |
| 870 } | 870 } |
| 871 | 871 |
| 872 void DelegatedFrameHost::UnlockResources() { | 872 void DelegatedFrameHost::UnlockResources() { |
| 873 DCHECK(local_surface_id_.is_valid()); | 873 DCHECK(local_surface_id_.is_valid()); |
| 874 delegated_frame_evictor_->UnlockFrame(); | 874 delegated_frame_evictor_->UnlockFrame(); |
| 875 } | 875 } |
| 876 | 876 |
| 877 } // namespace content | 877 } // namespace content |
| OLD | NEW |