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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp

Issue 2503203002: Revert "Getting rid of DelegatedFrameData" (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « services/ui/ws/window_tree_client_unittest.cc ('k') | tools/ipc_fuzzer/fuzzer/fuzzer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h" 5 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/quads/texture_draw_quad.h" 8 #include "cc/quads/texture_draw_quad.h"
9 #include "gpu/command_buffer/client/gles2_interface.h" 9 #include "gpu/command_buffer/client/gles2_interface.h"
10 #include "platform/CrossThreadFunctional.h" 10 #include "platform/CrossThreadFunctional.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 double commitStartTime, 179 double commitStartTime,
180 bool isWebGLSoftwareRendering /* This flag is true when WebGL's commit is 180 bool isWebGLSoftwareRendering /* This flag is true when WebGL's commit is
181 called on SwiftShader. */) { 181 called on SwiftShader. */) {
182 if (!image) 182 if (!image)
183 return; 183 return;
184 if (!verifyImageSize(image->size())) 184 if (!verifyImageSize(image->size()))
185 return; 185 return;
186 cc::CompositorFrame frame; 186 cc::CompositorFrame frame;
187 // TODO(crbug.com/652931): update the device_scale_factor 187 // TODO(crbug.com/652931): update the device_scale_factor
188 frame.metadata.device_scale_factor = 1.0f; 188 frame.metadata.device_scale_factor = 1.0f;
189 frame.delegated_frame_data.reset(new cc::DelegatedFrameData);
189 190
190 const gfx::Rect bounds(m_width, m_height); 191 const gfx::Rect bounds(m_width, m_height);
191 const cc::RenderPassId renderPassId(1, 1); 192 const cc::RenderPassId renderPassId(1, 1);
192 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); 193 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
193 pass->SetAll(renderPassId, bounds, bounds, gfx::Transform(), false); 194 pass->SetAll(renderPassId, bounds, bounds, gfx::Transform(), false);
194 195
195 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 196 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
196 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, false, 1.f, 197 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, false, 1.f,
197 SkXfermode::kSrcOver_Mode, 0); 198 SkXfermode::kSrcOver_Mode, 0);
198 199
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 Platform::current()->mainThread()->getWebTaskRunner()->postTask( 250 Platform::current()->mainThread()->getWebTaskRunner()->postTask(
250 BLINK_FROM_HERE, 251 BLINK_FROM_HERE,
251 crossThreadBind(updatePlaceholderImage, this->createWeakPtr(), 252 crossThreadBind(updatePlaceholderImage, this->createWeakPtr(),
252 passed(std::move(dispatcherTaskRunner)), 253 passed(std::move(dispatcherTaskRunner)),
253 m_placeholderCanvasId, std::move(image), resource.id)); 254 m_placeholderCanvasId, std::move(image), resource.id));
254 m_spareResourceLocks.add(m_nextResourceId); 255 m_spareResourceLocks.add(m_nextResourceId);
255 256
256 commitTypeHistogram.count(commitType); 257 commitTypeHistogram.count(commitType);
257 258
258 m_nextResourceId++; 259 m_nextResourceId++;
259 frame.resource_list.push_back(std::move(resource)); 260 frame.delegated_frame_data->resource_list.push_back(std::move(resource));
260 261
261 cc::TextureDrawQuad* quad = 262 cc::TextureDrawQuad* quad =
262 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); 263 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
263 gfx::Size rectSize(m_width, m_height); 264 gfx::Size rectSize(m_width, m_height);
264 265
265 const bool needsBlending = true; 266 const bool needsBlending = true;
266 // TOOD(crbug.com/645993): this should be inherited from WebGL context's 267 // TOOD(crbug.com/645993): this should be inherited from WebGL context's
267 // creation settings. 268 // creation settings.
268 const bool premultipliedAlpha = true; 269 const bool premultipliedAlpha = true;
269 const gfx::PointF uvTopLeft(0.f, 0.f); 270 const gfx::PointF uvTopLeft(0.f, 0.f);
270 const gfx::PointF uvBottomRight(1.f, 1.f); 271 const gfx::PointF uvBottomRight(1.f, 1.f);
271 float vertexOpacity[4] = {1.f, 1.f, 1.f, 1.f}; 272 float vertexOpacity[4] = {1.f, 1.f, 1.f, 1.f};
272 // TODO(crbug.com/645994): this should be true when using style 273 // TODO(crbug.com/645994): this should be true when using style
273 // "image-rendering: pixelated". 274 // "image-rendering: pixelated".
274 const bool nearestNeighbor = false; 275 const bool nearestNeighbor = false;
275 quad->SetAll(sqs, bounds, bounds, bounds, needsBlending, resource.id, 276 quad->SetAll(sqs, bounds, bounds, bounds, needsBlending, resource.id,
276 gfx::Size(), premultipliedAlpha, uvTopLeft, uvBottomRight, 277 gfx::Size(), premultipliedAlpha, uvTopLeft, uvBottomRight,
277 SK_ColorTRANSPARENT, vertexOpacity, yflipped, nearestNeighbor, 278 SK_ColorTRANSPARENT, vertexOpacity, yflipped, nearestNeighbor,
278 false); 279 false);
279 280
280 frame.render_pass_list.push_back(std::move(pass)); 281 frame.delegated_frame_data->render_pass_list.push_back(std::move(pass));
281 282
282 double elapsedTime = WTF::monotonicallyIncreasingTime() - commitStartTime; 283 double elapsedTime = WTF::monotonicallyIncreasingTime() - commitStartTime;
283 284
284 switch (commitType) { 285 switch (commitType) {
285 case CommitGPUCanvasGPUCompositing: 286 case CommitGPUCanvasGPUCompositing:
286 if (isMainThread()) { 287 if (isMainThread()) {
287 DEFINE_STATIC_LOCAL( 288 DEFINE_STATIC_LOCAL(
288 CustomCountHistogram, commitGPUCanvasGPUCompositingMainTimer, 289 CustomCountHistogram, commitGPUCanvasGPUCompositingMainTimer,
289 ("Blink.Canvas.OffscreenCommit.GPUCanvasGPUCompositingMain", 0, 290 ("Blink.Canvas.OffscreenCommit.GPUCanvasGPUCompositingMain", 0,
290 10000000, 50)); 291 10000000, 50));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 396 }
396 397
397 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize( 398 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize(
398 const IntSize imageSize) { 399 const IntSize imageSize) {
399 if (imageSize.width() == m_width && imageSize.height() == m_height) 400 if (imageSize.width() == m_width && imageSize.height() == m_height)
400 return true; 401 return true;
401 return false; 402 return false;
402 } 403 }
403 404
404 } // namespace blink 405 } // namespace blink
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree_client_unittest.cc ('k') | tools/ipc_fuzzer/fuzzer/fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698