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

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

Issue 2517343003: Update Resize information from OffscreenCanvas to OffscreenCanvasFrameDispatcher (Closed)
Patch Set: fix error Created 4 years 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 uint32_t localId, 33 uint32_t localId,
34 uint64_t nonceHigh, 34 uint64_t nonceHigh,
35 uint64_t nonceLow, 35 uint64_t nonceLow,
36 int canvasId, 36 int canvasId,
37 int width, 37 int width,
38 int height) 38 int height)
39 : m_surfaceId( 39 : m_frameSinkId(cc::FrameSinkId(clientId, sinkId)),
40 cc::FrameSinkId(clientId, sinkId), 40 m_currentLocalFrameId(cc::LocalFrameId(
41 cc::LocalFrameId( 41 localId,
42 localId, 42 base::UnguessableToken::Deserialize(nonceHigh, nonceLow))),
43 base::UnguessableToken::Deserialize(nonceHigh, nonceLow))),
44 m_width(width), 43 m_width(width),
45 m_height(height), 44 m_height(height),
46 m_nextResourceId(1u), 45 m_nextResourceId(1u),
47 m_binding(this), 46 m_binding(this),
48 m_placeholderCanvasId(canvasId) { 47 m_placeholderCanvasId(canvasId) {
49 DCHECK(!m_sink.is_bound()); 48 DCHECK(!m_sink.is_bound());
50 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; 49 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider;
51 Platform::current()->interfaceProvider()->getInterface( 50 Platform::current()->interfaceProvider()->getInterface(
52 mojo::GetProxy(&provider)); 51 mojo::GetProxy(&provider));
53 provider->CreateCompositorFrameSink(m_surfaceId, 52 cc::SurfaceId surfaceId(m_frameSinkId, m_currentLocalFrameId);
53 provider->CreateCompositorFrameSink(surfaceId,
54 m_binding.CreateInterfacePtrAndBind(), 54 m_binding.CreateInterfacePtrAndBind(),
55 mojo::GetProxy(&m_sink)); 55 mojo::GetProxy(&m_sink));
56 } 56 }
57 57
58 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap( 58 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap(
59 cc::TransferableResource& resource, 59 cc::TransferableResource& resource,
60 RefPtr<StaticBitmapImage> image) { 60 RefPtr<StaticBitmapImage> image) {
61 std::unique_ptr<cc::SharedBitmap> bitmap = 61 std::unique_ptr<cc::SharedBitmap> bitmap =
62 Platform::current()->allocateSharedBitmap(IntSize(m_width, m_height)); 62 Platform::current()->allocateSharedBitmap(IntSize(m_width, m_height));
63 if (!bitmap) 63 if (!bitmap)
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 "SoftwareCanvasSoftwareCompositingWorker", 351 "SoftwareCanvasSoftwareCompositingWorker",
352 0, 10000000, 50)); 352 0, 10000000, 50));
353 commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime * 353 commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime *
354 1000000.0); 354 1000000.0);
355 } 355 }
356 break; 356 break;
357 case OffscreenCanvasCommitTypeCount: 357 case OffscreenCanvasCommitTypeCount:
358 NOTREACHED(); 358 NOTREACHED();
359 } 359 }
360 360
361 m_sink->SubmitCompositorFrame(m_surfaceId.local_frame_id(), std::move(frame)); 361 m_sink->SubmitCompositorFrame(m_currentLocalFrameId, std::move(frame));
362 } 362 }
363 363
364 void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck() { 364 void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck() {
365 // TODO(fsamuel): Implement this. 365 // TODO(fsamuel): Implement this.
366 } 366 }
367 367
368 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame( 368 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame(
369 const cc::BeginFrameArgs& beginFrameArgs) {} 369 const cc::BeginFrameArgs& beginFrameArgs) {}
370 370
371 void OffscreenCanvasFrameDispatcherImpl::ReclaimResources( 371 void OffscreenCanvasFrameDispatcherImpl::ReclaimResources(
(...skipping 22 matching lines...) Expand all
394 m_cachedTextureIds.remove(resourceId); 394 m_cachedTextureIds.remove(resourceId);
395 } 395 }
396 396
397 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize( 397 bool OffscreenCanvasFrameDispatcherImpl::verifyImageSize(
398 const IntSize imageSize) { 398 const IntSize imageSize) {
399 if (imageSize.width() == m_width && imageSize.height() == m_height) 399 if (imageSize.width() == m_width && imageSize.height() == m_height)
400 return true; 400 return true;
401 return false; 401 return false;
402 } 402 }
403 403
404 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) {
405 m_width = width;
406 m_height = height;
407 }
408
404 } // namespace blink 409 } // 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