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

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

Issue 2588053003: Make OffscreenCanvas resizable (Closed)
Patch Set: rebase Created 3 years, 12 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h ('k') | no next file » | 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 18 matching lines...) Expand all
29 29
30 OffscreenCanvasFrameDispatcherImpl::OffscreenCanvasFrameDispatcherImpl( 30 OffscreenCanvasFrameDispatcherImpl::OffscreenCanvasFrameDispatcherImpl(
31 uint32_t clientId, 31 uint32_t clientId,
32 uint32_t sinkId, 32 uint32_t sinkId,
33 int canvasId, 33 int canvasId,
34 int width, 34 int width,
35 int height) 35 int height)
36 : m_frameSinkId(cc::FrameSinkId(clientId, sinkId)), 36 : m_frameSinkId(cc::FrameSinkId(clientId, sinkId)),
37 m_width(width), 37 m_width(width),
38 m_height(height), 38 m_height(height),
39 m_changeSizeForNextCommit(false),
39 m_nextResourceId(1u), 40 m_nextResourceId(1u),
40 m_binding(this), 41 m_binding(this),
41 m_placeholderCanvasId(canvasId) { 42 m_placeholderCanvasId(canvasId) {
42 m_currentLocalFrameId = m_surfaceIdAllocator.GenerateId(); 43 m_currentLocalFrameId = m_surfaceIdAllocator.GenerateId();
43 DCHECK(!m_sink.is_bound()); 44 DCHECK(!m_sink.is_bound());
44 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; 45 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider;
45 Platform::current()->interfaceProvider()->getInterface( 46 Platform::current()->interfaceProvider()->getInterface(
46 mojo::MakeRequest(&provider)); 47 mojo::MakeRequest(&provider));
47 provider->CreateCompositorFrameSink(m_frameSinkId, 48 provider->CreateCompositorFrameSink(m_frameSinkId,
48 m_binding.CreateInterfacePtrAndBind(), 49 m_binding.CreateInterfacePtrAndBind(),
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 "SoftwareCanvasSoftwareCompositingWorker", 351 "SoftwareCanvasSoftwareCompositingWorker",
351 0, 10000000, 50)); 352 0, 10000000, 50));
352 commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime * 353 commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime *
353 1000000.0); 354 1000000.0);
354 } 355 }
355 break; 356 break;
356 case OffscreenCanvasCommitTypeCount: 357 case OffscreenCanvasCommitTypeCount:
357 NOTREACHED(); 358 NOTREACHED();
358 } 359 }
359 360
361 if (m_changeSizeForNextCommit) {
362 m_currentLocalFrameId = m_surfaceIdAllocator.GenerateId();
363 m_changeSizeForNextCommit = false;
364 }
360 m_sink->SubmitCompositorFrame(m_currentLocalFrameId, std::move(frame)); 365 m_sink->SubmitCompositorFrame(m_currentLocalFrameId, std::move(frame));
361 } 366 }
362 367
363 void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck() { 368 void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck() {
364 // TODO(fsamuel): Implement this. 369 // TODO(fsamuel): Implement this.
365 } 370 }
366 371
367 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame( 372 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame(
368 const cc::BeginFrameArgs& beginFrameArgs) {} 373 const cc::BeginFrameArgs& beginFrameArgs) {}
369 374
(...skipping 29 matching lines...) Expand all
399 } 404 }
400 405
401 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize( 406 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize(
402 const IntSize imageSize) { 407 const IntSize imageSize) {
403 if (imageSize.width() == m_width && imageSize.height() == m_height) 408 if (imageSize.width() == m_width && imageSize.height() == m_height)
404 return true; 409 return true;
405 return false; 410 return false;
406 } 411 }
407 412
408 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { 413 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) {
409 m_width = width; 414 if (m_width != width || m_height != height) {
410 m_height = height; 415 m_width = width;
416 m_height = height;
417 m_changeSizeForNextCommit = true;
418 }
411 } 419 }
412 420
413 } // namespace blink 421 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698