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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2584643002: Revamp OffscreenCanvas commit flow (Closed)
Patch Set: more fix 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 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "platform/graphics/Canvas2DImageBufferSurface.h" 61 #include "platform/graphics/Canvas2DImageBufferSurface.h"
62 #include "platform/graphics/CanvasMetrics.h" 62 #include "platform/graphics/CanvasMetrics.h"
63 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 63 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
64 #include "platform/graphics/ImageBuffer.h" 64 #include "platform/graphics/ImageBuffer.h"
65 #include "platform/graphics/RecordingImageBufferSurface.h" 65 #include "platform/graphics/RecordingImageBufferSurface.h"
66 #include "platform/graphics/StaticBitmapImage.h" 66 #include "platform/graphics/StaticBitmapImage.h"
67 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 67 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
68 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" 68 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h"
69 #include "platform/image-encoders/ImageEncoderUtils.h" 69 #include "platform/image-encoders/ImageEncoderUtils.h"
70 #include "platform/transforms/AffineTransform.h" 70 #include "platform/transforms/AffineTransform.h"
71 #include "public/platform/InterfaceProvider.h"
72 #include "public/platform/Platform.h" 71 #include "public/platform/Platform.h"
73 #include "public/platform/WebTraceLocation.h" 72 #include "public/platform/WebTraceLocation.h"
74 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h"
75 #include "wtf/CheckedNumeric.h" 73 #include "wtf/CheckedNumeric.h"
76 #include "wtf/PtrUtil.h" 74 #include "wtf/PtrUtil.h"
77 #include <math.h> 75 #include <math.h>
78 #include <memory> 76 #include <memory>
79 #include <v8.h> 77 #include <v8.h>
80 78
81 namespace blink { 79 namespace blink {
82 80
83 using namespace HTMLNames; 81 using namespace HTMLNames;
84 82
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 return m_context->getControlAndIdIfHitRegionExists(location); 1388 return m_context->getControlAndIdIfHitRegionExists(location);
1391 return HitTestCanvasResult::create(String(), nullptr); 1389 return HitTestCanvasResult::create(String(), nullptr);
1392 } 1390 }
1393 1391
1394 String HTMLCanvasElement::getIdFromControl(const Element* element) { 1392 String HTMLCanvasElement::getIdFromControl(const Element* element) {
1395 if (m_context) 1393 if (m_context)
1396 return m_context->getIdFromControl(element); 1394 return m_context->getIdFromControl(element);
1397 return String(); 1395 return String();
1398 } 1396 }
1399 1397
1400 bool HTMLCanvasElement::createSurfaceLayer() { 1398 void HTMLCanvasElement::createLayer() {
1401 DCHECK(!m_surfaceLayerBridge); 1399 DCHECK(!m_surfaceLayerBridge);
1402 mojom::blink::OffscreenCanvasSurfacePtr service; 1400
1403 Platform::current()->interfaceProvider()->getInterface( 1401 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this));
1404 mojo::GetProxy(&service)); 1402 // Creates a placeholder layer first before Surface is created.
1405 m_surfaceLayerBridge = 1403 m_surfaceLayerBridge->createSolidColorLayer();
1406 WTF::wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); 1404 }
1407 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), 1405
1408 this->height()); 1406 void HTMLCanvasElement::OnWebLayerReplaced() {
1407 setNeedsCompositingUpdate();
1409 } 1408 }
1410 1409
1411 } // namespace blink 1410 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698