Chromium Code Reviews| 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/gfx/switches.h" | 70 #include "ui/gfx/switches.h" |
| 70 #include "ui/gl/gl_switches.h" | 71 #include "ui/gl/gl_switches.h" |
| 71 #include "ui/native_theme/native_theme_features.h" | 72 #include "ui/native_theme/native_theme_features.h" |
| 72 #include "ui/native_theme/overlay_scrollbar_constants_aura.h" | 73 #include "ui/native_theme/overlay_scrollbar_constants_aura.h" |
| 73 | 74 |
| 74 namespace base { | 75 namespace base { |
| 75 class Value; | 76 class Value; |
| 76 } | 77 } |
| 77 | 78 |
| 78 namespace cc { | 79 namespace cc { |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1064 } | 1065 } |
| 1065 | 1066 |
| 1066 void RenderWidgetCompositor::SetBrowserControlsShownRatio(float ratio) { | 1067 void RenderWidgetCompositor::SetBrowserControlsShownRatio(float ratio) { |
| 1067 layer_tree_host_->SetBrowserControlsShownRatio(ratio); | 1068 layer_tree_host_->SetBrowserControlsShownRatio(ratio); |
| 1068 } | 1069 } |
| 1069 | 1070 |
| 1070 void RenderWidgetCompositor::setBottomControlsHeight(float height) { | 1071 void RenderWidgetCompositor::setBottomControlsHeight(float height) { |
| 1071 layer_tree_host_->SetBottomControlsHeight(height); | 1072 layer_tree_host_->SetBottomControlsHeight(height); |
| 1072 } | 1073 } |
| 1073 | 1074 |
| 1075 void RenderWidgetCompositor::RequestDecode( | |
| 1076 sk_sp<SkImage> image, | |
| 1077 const base::Callback<void(bool)>& callback) { | |
| 1078 layer_tree_host_->QueueImageDecode(std::move(image), callback); | |
|
pdr.
2017/05/18 03:20:10
If javascript calls decode() twice on a loaded ima
vmpstr
2017/05/18 18:51:12
It issues two different promises and makes two dif
| |
| 1079 | |
| 1080 // If we're compositing synchronously, the SetNeedsCommit call which will be | |
| 1081 // issued by |layer_tree_host_| is not going to cause a commit, due to the | |
| 1082 // fact that this would make layout tests slow and cause flakiness. However, | |
| 1083 // in this case we actually need a commit to transfer the decode requests to | |
| 1084 // the impl side. So, force a commit to happen. | |
| 1085 if (CompositeIsSynchronous()) { | |
| 1086 base::ThreadTaskRunnerHandle::Get()->PostTask( | |
| 1087 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | |
| 1088 weak_factory_.GetWeakPtr())); | |
| 1089 } | |
| 1090 } | |
| 1091 | |
| 1074 void RenderWidgetCompositor::WillBeginMainFrame() { | 1092 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 1075 delegate_->WillBeginCompositorFrame(); | 1093 delegate_->WillBeginCompositorFrame(); |
| 1076 } | 1094 } |
| 1077 | 1095 |
| 1078 void RenderWidgetCompositor::DidBeginMainFrame() {} | 1096 void RenderWidgetCompositor::DidBeginMainFrame() {} |
| 1079 | 1097 |
| 1080 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { | 1098 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
| 1081 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); | 1099 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); |
| 1082 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); | 1100 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); |
| 1083 delegate_->BeginMainFrame(frame_time_sec); | 1101 delegate_->BeginMainFrame(frame_time_sec); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1207 const cc::LocalSurfaceId& local_surface_id) { | 1225 const cc::LocalSurfaceId& local_surface_id) { |
| 1208 layer_tree_host_->SetLocalSurfaceId(local_surface_id); | 1226 layer_tree_host_->SetLocalSurfaceId(local_surface_id); |
| 1209 } | 1227 } |
| 1210 | 1228 |
| 1211 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { | 1229 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { |
| 1212 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( | 1230 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( |
| 1213 std::move(callback), base::ThreadTaskRunnerHandle::Get())); | 1231 std::move(callback), base::ThreadTaskRunnerHandle::Get())); |
| 1214 } | 1232 } |
| 1215 | 1233 |
| 1216 } // namespace content | 1234 } // namespace content |
| OLD | NEW |