Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2769823002: Add decode() functionality to image elements. (Closed)
Patch Set: diff plumbing Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 } 1020 }
1020 1021
1021 void RenderWidgetCompositor::SetBrowserControlsShownRatio(float ratio) { 1022 void RenderWidgetCompositor::SetBrowserControlsShownRatio(float ratio) {
1022 layer_tree_host_->SetBrowserControlsShownRatio(ratio); 1023 layer_tree_host_->SetBrowserControlsShownRatio(ratio);
1023 } 1024 }
1024 1025
1025 void RenderWidgetCompositor::setBottomControlsHeight(float height) { 1026 void RenderWidgetCompositor::setBottomControlsHeight(float height) {
1026 layer_tree_host_->SetBottomControlsHeight(height); 1027 layer_tree_host_->SetBottomControlsHeight(height);
1027 } 1028 }
1028 1029
1030 void RenderWidgetCompositor::RequestDecode(
1031 sk_sp<SkImage> image,
1032 const base::Callback<void(bool)>& callback) {
1033 layer_tree_host_->QueueImageDecode(std::move(image), callback);
1034
1035 // If we're compositing synchronously, the SetNeedsCommit call which will be
1036 // issued by |layer_tree_host_| is not going to cause a commit, due to the
1037 // fact that this would make layout tests slow and cause flakiness. However,
1038 // in this case we actually need a commit to transfer the decode requests to
1039 // the impl side. So, force a commit to happen.
1040 if (CompositeIsSynchronous()) {
1041 base::ThreadTaskRunnerHandle::Get()->PostTask(
1042 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite,
1043 weak_factory_.GetWeakPtr()));
1044 }
1045 }
1046
1029 void RenderWidgetCompositor::WillBeginMainFrame() { 1047 void RenderWidgetCompositor::WillBeginMainFrame() {
1030 delegate_->WillBeginCompositorFrame(); 1048 delegate_->WillBeginCompositorFrame();
1031 } 1049 }
1032 1050
1033 void RenderWidgetCompositor::DidBeginMainFrame() {} 1051 void RenderWidgetCompositor::DidBeginMainFrame() {}
1034 1052
1035 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { 1053 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) {
1036 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); 1054 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args);
1037 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); 1055 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF();
1038 delegate_->BeginMainFrame(frame_time_sec); 1056 delegate_->BeginMainFrame(frame_time_sec);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { 1165 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) {
1148 layer_tree_host_->SetContentSourceId(id); 1166 layer_tree_host_->SetContentSourceId(id);
1149 } 1167 }
1150 1168
1151 void RenderWidgetCompositor::SetLocalSurfaceId( 1169 void RenderWidgetCompositor::SetLocalSurfaceId(
1152 const cc::LocalSurfaceId& local_surface_id) { 1170 const cc::LocalSurfaceId& local_surface_id) {
1153 layer_tree_host_->SetLocalSurfaceId(local_surface_id); 1171 layer_tree_host_->SetLocalSurfaceId(local_surface_id);
1154 } 1172 }
1155 1173
1156 } // namespace content 1174 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698