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_factory.h" | 14 #include "cc/surfaces/surface_factory.h" |
15 #include "content/browser/compositor/resize_lock.h" | 15 #include "content/browser/compositor/resize_lock.h" |
| 16 #include "content/browser/gpu/compositor_util.h" |
16 #include "content/common/gpu/client/gl_helper.h" | 17 #include "content/common/gpu/client/gl_helper.h" |
17 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 18 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
18 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
19 #include "media/base/video_frame.h" | 20 #include "media/base/video_frame.h" |
20 #include "media/base/video_util.h" | 21 #include "media/base/video_util.h" |
21 #include "skia/ext/image_operations.h" | 22 #include "skia/ext/image_operations.h" |
22 #include "third_party/skia/include/core/SkCanvas.h" | 23 #include "third_party/skia/include/core/SkCanvas.h" |
23 #include "third_party/skia/include/core/SkPaint.h" | 24 #include "third_party/skia/include/core/SkPaint.h" |
24 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 25 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
25 #include "ui/gfx/frame_time.h" | 26 #include "ui/gfx/frame_time.h" |
(...skipping 20 matching lines...) Expand all Loading... |
46 void DelegatedFrameHostClient::RequestCopyOfOutput( | 47 void DelegatedFrameHostClient::RequestCopyOfOutput( |
47 scoped_ptr<cc::CopyOutputRequest> request) { | 48 scoped_ptr<cc::CopyOutputRequest> request) { |
48 GetDelegatedFrameHost()->RequestCopyOfOutput(request.Pass()); | 49 GetDelegatedFrameHost()->RequestCopyOfOutput(request.Pass()); |
49 } | 50 } |
50 | 51 |
51 //////////////////////////////////////////////////////////////////////////////// | 52 //////////////////////////////////////////////////////////////////////////////// |
52 // DelegatedFrameHost | 53 // DelegatedFrameHost |
53 | 54 |
54 DelegatedFrameHost::DelegatedFrameHost(DelegatedFrameHostClient* client) | 55 DelegatedFrameHost::DelegatedFrameHost(DelegatedFrameHostClient* client) |
55 : client_(client), | 56 : client_(client), |
56 use_surfaces_(base::CommandLine::ForCurrentProcess()->HasSwitch( | 57 use_surfaces_(UseSurfacesEnabled()), |
57 switches::kUseSurfaces)), | |
58 last_output_surface_id_(0), | 58 last_output_surface_id_(0), |
59 pending_delegated_ack_count_(0), | 59 pending_delegated_ack_count_(0), |
60 skipped_frames_(false), | 60 skipped_frames_(false), |
61 can_lock_compositor_(YES_CAN_LOCK), | 61 can_lock_compositor_(YES_CAN_LOCK), |
62 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { | 62 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { |
63 ImageTransportFactory::GetInstance()->AddObserver(this); | 63 ImageTransportFactory::GetInstance()->AddObserver(this); |
64 } | 64 } |
65 | 65 |
66 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) { | 66 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) { |
67 delegated_frame_evictor_->SetVisible(true); | 67 delegated_frame_evictor_->SetVisible(true); |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 if (frame_provider_.get()) { | 976 if (frame_provider_.get()) { |
977 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 977 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
978 current_frame_size_in_dip_); | 978 current_frame_size_in_dip_); |
979 } | 979 } |
980 if (!surface_id_.is_null()) { | 980 if (!surface_id_.is_null()) { |
981 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); | 981 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); |
982 } | 982 } |
983 } | 983 } |
984 | 984 |
985 } // namespace content | 985 } // namespace content |
OLD | NEW |