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

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

Issue 2521013003: Compositing Layer update for OffscreenCanvas resize (Closed)
Patch Set: test 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
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 16 matching lines...) Expand all
27 27
28 namespace blink { 28 namespace blink {
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 unsigned width,
38 int height) 38 unsigned height)
39 : m_surfaceId( 39 : m_frameSinkId(cc::FrameSinkId(clientId, sinkId)),
40 cc::FrameSinkId(clientId, sinkId), 40 m_width(clampTo<int>(width)),
41 cc::LocalFrameId( 41 m_height(clampTo<int>(height)),
42 localId,
43 base::UnguessableToken::Deserialize(nonceHigh, nonceLow))),
44 m_width(width),
45 m_height(height),
46 m_nextResourceId(1u), 42 m_nextResourceId(1u),
47 m_binding(this), 43 m_binding(this),
48 m_placeholderCanvasId(canvasId) { 44 m_placeholderCanvasId(canvasId) {
49 DCHECK(!m_sink.is_bound()); 45 DCHECK(!m_sink.is_bound());
50 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; 46 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider;
51 Platform::current()->interfaceProvider()->getInterface( 47 Platform::current()->interfaceProvider()->getInterface(
52 mojo::GetProxy(&provider)); 48 mojo::GetProxy(&provider));
53 provider->CreateCompositorFrameSink(m_surfaceId, 49 cc::SurfaceId surfaceId(
50 m_frameSinkId,
51 cc::LocalFrameId(
52 localId, base::UnguessableToken::Deserialize(nonceHigh, nonceLow)));
53
54 provider->CreateCompositorFrameSink(surfaceId,
54 m_binding.CreateInterfacePtrAndBind(), 55 m_binding.CreateInterfacePtrAndBind(),
55 mojo::GetProxy(&m_sink)); 56 mojo::GetProxy(&m_sink));
56 } 57 }
57 58
58 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap( 59 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap(
59 cc::TransferableResource& resource, 60 cc::TransferableResource& resource,
60 RefPtr<StaticBitmapImage> image) { 61 RefPtr<StaticBitmapImage> image) {
61 std::unique_ptr<cc::SharedBitmap> bitmap = 62 std::unique_ptr<cc::SharedBitmap> bitmap =
62 Platform::current()->allocateSharedBitmap(IntSize(m_width, m_height)); 63 Platform::current()->allocateSharedBitmap(IntSize(m_width, m_height));
63 if (!bitmap) 64 if (!bitmap)
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 m_cachedTextureIds.remove(resourceId); 395 m_cachedTextureIds.remove(resourceId);
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
405 void OffscreenCanvasFrameDispatcherImpl::reshape(unsigned width,
406 unsigned height) {
407 m_width = clampTo<int>(width);
408 m_height = clampTo<int>(height);
409 }
410
404 } // namespace blink 411 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698