OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "gpu/command_buffer/service/gpu_switches.h" | 59 #include "gpu/command_buffer/service/gpu_switches.h" |
60 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 60 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
61 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" | 61 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" |
62 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" | 62 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" |
63 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" | 63 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" |
64 #include "third_party/WebKit/public/platform/WebSize.h" | 64 #include "third_party/WebKit/public/platform/WebSize.h" |
65 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 65 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
66 #include "third_party/WebKit/public/web/WebKit.h" | 66 #include "third_party/WebKit/public/web/WebKit.h" |
67 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 67 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
68 #include "third_party/WebKit/public/web/WebSelection.h" | 68 #include "third_party/WebKit/public/web/WebSelection.h" |
| 69 #include "third_party/skia/include/core/SkImage.h" |
69 #include "ui/gl/gl_switches.h" | 70 #include "ui/gl/gl_switches.h" |
70 #include "ui/native_theme/native_theme_switches.h" | 71 #include "ui/native_theme/native_theme_switches.h" |
71 #include "ui/native_theme/overlay_scrollbar_constants_aura.h" | 72 #include "ui/native_theme/overlay_scrollbar_constants_aura.h" |
72 | 73 |
73 namespace base { | 74 namespace base { |
74 class Value; | 75 class Value; |
75 } | 76 } |
76 | 77 |
77 namespace cc { | 78 namespace cc { |
78 class Layer; | 79 class Layer; |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 } | 1025 } |
1025 | 1026 |
1026 void RenderWidgetCompositor::setBrowserControlsShownRatio(float ratio) { | 1027 void RenderWidgetCompositor::setBrowserControlsShownRatio(float ratio) { |
1027 layer_tree_host_->SetBrowserControlsShownRatio(ratio); | 1028 layer_tree_host_->SetBrowserControlsShownRatio(ratio); |
1028 } | 1029 } |
1029 | 1030 |
1030 void RenderWidgetCompositor::setBottomControlsHeight(float height) { | 1031 void RenderWidgetCompositor::setBottomControlsHeight(float height) { |
1031 layer_tree_host_->SetBottomControlsHeight(height); | 1032 layer_tree_host_->SetBottomControlsHeight(height); |
1032 } | 1033 } |
1033 | 1034 |
| 1035 void RenderWidgetCompositor::requestDecode( |
| 1036 sk_sp<SkImage> image, |
| 1037 const base::Callback<void(bool)>& callback) { |
| 1038 layer_tree_host_->QueueImageDecode(std::move(image), callback); |
| 1039 |
| 1040 // If we're compositing synchronously, the SetNeedsCommit call which will be |
| 1041 // issued by |layer_tree_host_| is not going to cause a commit, due to the |
| 1042 // fact that this would make layout tests slow and cause flakiness. However, |
| 1043 // in this case we actually need a commit to transfer the decode requests to |
| 1044 // the impl side. So, force a commit to happen. |
| 1045 if (CompositeIsSynchronous()) { |
| 1046 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1047 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
| 1048 weak_factory_.GetWeakPtr())); |
| 1049 } |
| 1050 } |
| 1051 |
1034 void RenderWidgetCompositor::WillBeginMainFrame() { | 1052 void RenderWidgetCompositor::WillBeginMainFrame() { |
1035 delegate_->WillBeginCompositorFrame(); | 1053 delegate_->WillBeginCompositorFrame(); |
1036 } | 1054 } |
1037 | 1055 |
1038 void RenderWidgetCompositor::DidBeginMainFrame() {} | 1056 void RenderWidgetCompositor::DidBeginMainFrame() {} |
1039 | 1057 |
1040 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { | 1058 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
1041 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); | 1059 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); |
1042 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); | 1060 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); |
1043 delegate_->BeginMainFrame(frame_time_sec); | 1061 delegate_->BeginMainFrame(frame_time_sec); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { | 1163 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { |
1146 layer_tree_host_->SetContentSourceId(id); | 1164 layer_tree_host_->SetContentSourceId(id); |
1147 } | 1165 } |
1148 | 1166 |
1149 void RenderWidgetCompositor::SetLocalSurfaceId( | 1167 void RenderWidgetCompositor::SetLocalSurfaceId( |
1150 const cc::LocalSurfaceId& local_surface_id) { | 1168 const cc::LocalSurfaceId& local_surface_id) { |
1151 layer_tree_host_->SetLocalSurfaceId(local_surface_id); | 1169 layer_tree_host_->SetLocalSurfaceId(local_surface_id); |
1152 } | 1170 } |
1153 | 1171 |
1154 } // namespace content | 1172 } // namespace content |
OLD | NEW |