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

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

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: nit 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);
190 189
191 const gfx::Rect bounds(m_width, m_height); 190 const gfx::Rect bounds(m_width, m_height);
192 const cc::RenderPassId renderPassId(1, 1); 191 const cc::RenderPassId renderPassId(1, 1);
193 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); 192 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
194 pass->SetAll(renderPassId, bounds, bounds, gfx::Transform(), false); 193 pass->SetAll(renderPassId, bounds, bounds, gfx::Transform(), false);
195 194
196 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 195 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
197 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, false, 1.f, 196 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, false, 1.f,
198 SkXfermode::kSrcOver_Mode, 0); 197 SkXfermode::kSrcOver_Mode, 0);
199 198
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 Platform::current()->mainThread()->getWebTaskRunner()->postTask( 249 Platform::current()->mainThread()->getWebTaskRunner()->postTask(
251 BLINK_FROM_HERE, 250 BLINK_FROM_HERE,
252 crossThreadBind(updatePlaceholderImage, this->createWeakPtr(), 251 crossThreadBind(updatePlaceholderImage, this->createWeakPtr(),
253 passed(std::move(dispatcherTaskRunner)), 252 passed(std::move(dispatcherTaskRunner)),
254 m_placeholderCanvasId, std::move(image), resource.id)); 253 m_placeholderCanvasId, std::move(image), resource.id));
255 m_spareResourceLocks.add(m_nextResourceId); 254 m_spareResourceLocks.add(m_nextResourceId);
256 255
257 commitTypeHistogram.count(commitType); 256 commitTypeHistogram.count(commitType);
258 257
259 m_nextResourceId++; 258 m_nextResourceId++;
260 frame.delegated_frame_data->resource_list.push_back(std::move(resource)); 259 frame.resource_list.push_back(std::move(resource));
261 260
262 cc::TextureDrawQuad* quad = 261 cc::TextureDrawQuad* quad =
263 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); 262 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
264 gfx::Size rectSize(m_width, m_height); 263 gfx::Size rectSize(m_width, m_height);
265 264
266 const bool needsBlending = true; 265 const bool needsBlending = true;
267 // TOOD(crbug.com/645993): this should be inherited from WebGL context's 266 // TOOD(crbug.com/645993): this should be inherited from WebGL context's
268 // creation settings. 267 // creation settings.
269 const bool premultipliedAlpha = true; 268 const bool premultipliedAlpha = true;
270 const gfx::PointF uvTopLeft(0.f, 0.f); 269 const gfx::PointF uvTopLeft(0.f, 0.f);
271 const gfx::PointF uvBottomRight(1.f, 1.f); 270 const gfx::PointF uvBottomRight(1.f, 1.f);
272 float vertexOpacity[4] = {1.f, 1.f, 1.f, 1.f}; 271 float vertexOpacity[4] = {1.f, 1.f, 1.f, 1.f};
273 // TODO(crbug.com/645994): this should be true when using style 272 // TODO(crbug.com/645994): this should be true when using style
274 // "image-rendering: pixelated". 273 // "image-rendering: pixelated".
275 const bool nearestNeighbor = false; 274 const bool nearestNeighbor = false;
276 quad->SetAll(sqs, bounds, bounds, bounds, needsBlending, resource.id, 275 quad->SetAll(sqs, bounds, bounds, bounds, needsBlending, resource.id,
277 gfx::Size(), premultipliedAlpha, uvTopLeft, uvBottomRight, 276 gfx::Size(), premultipliedAlpha, uvTopLeft, uvBottomRight,
278 SK_ColorTRANSPARENT, vertexOpacity, yflipped, nearestNeighbor, 277 SK_ColorTRANSPARENT, vertexOpacity, yflipped, nearestNeighbor,
279 false); 278 false);
280 279
281 frame.delegated_frame_data->render_pass_list.push_back(std::move(pass)); 280 frame.render_pass_list.push_back(std::move(pass));
282 281
283 double elapsedTime = WTF::monotonicallyIncreasingTime() - commitStartTime; 282 double elapsedTime = WTF::monotonicallyIncreasingTime() - commitStartTime;
284 283
285 switch (commitType) { 284 switch (commitType) {
286 case CommitGPUCanvasGPUCompositing: 285 case CommitGPUCanvasGPUCompositing:
287 if (isMainThread()) { 286 if (isMainThread()) {
288 DEFINE_STATIC_LOCAL( 287 DEFINE_STATIC_LOCAL(
289 CustomCountHistogram, commitGPUCanvasGPUCompositingMainTimer, 288 CustomCountHistogram, commitGPUCanvasGPUCompositingMainTimer,
290 ("Blink.Canvas.OffscreenCommit.GPUCanvasGPUCompositingMain", 0, 289 ("Blink.Canvas.OffscreenCommit.GPUCanvasGPUCompositingMain", 0,
291 10000000, 50)); 290 10000000, 50));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 } 395 }
397 396
398 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize( 397 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize(
399 const IntSize imageSize) { 398 const IntSize imageSize) {
400 if (imageSize.width() == m_width && imageSize.height() == m_height) 399 if (imageSize.width() == m_width && imageSize.height() == m_height)
401 return true; 400 return true;
402 return false; 401 return false;
403 } 402 }
404 403
405 } // namespace blink 404 } // 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