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

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

Issue 2262363002: Ensure ImageBuffer is never used with ImageBitmapRenderingContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 | « no previous file | 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 /* 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 { 976 {
977 if (!hasImageBuffer()) 977 if (!hasImageBuffer())
978 return nullptr; 978 return nullptr;
979 979
980 return m_imageBuffer->canvas(); 980 return m_imageBuffer->canvas();
981 } 981 }
982 982
983 ImageBuffer* HTMLCanvasElement::buffer() const 983 ImageBuffer* HTMLCanvasElement::buffer() const
984 { 984 {
985 DCHECK(m_context); 985 DCHECK(m_context);
986 DCHECK(m_context->getContextType() != CanvasRenderingContext::ContextImageBi tmap);
986 if (!hasImageBuffer() && !m_didFailToCreateImageBuffer) 987 if (!hasImageBuffer() && !m_didFailToCreateImageBuffer)
987 const_cast<HTMLCanvasElement*>(this)->createImageBuffer(); 988 const_cast<HTMLCanvasElement*>(this)->createImageBuffer();
988 return m_imageBuffer.get(); 989 return m_imageBuffer.get();
989 } 990 }
990 991
991 void HTMLCanvasElement::createImageBufferUsingSurfaceForTesting(std::unique_ptr< ImageBufferSurface> surface) 992 void HTMLCanvasElement::createImageBufferUsingSurfaceForTesting(std::unique_ptr< ImageBufferSurface> surface)
992 { 993 {
993 discardImageBuffer(); 994 discardImageBuffer();
994 setWidth(surface->size().width()); 995 setWidth(surface->size().width());
995 setHeight(surface->size().height()); 996 setHeight(surface->size().height());
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 1217
1217 bool HTMLCanvasElement::createSurfaceLayer() 1218 bool HTMLCanvasElement::createSurfaceLayer()
1218 { 1219 {
1219 DCHECK(!m_surfaceLayerBridge); 1220 DCHECK(!m_surfaceLayerBridge);
1220 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); 1221 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl());
1221 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); 1222 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient)));
1222 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); 1223 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( ));
1223 } 1224 }
1224 1225
1225 } // namespace blink 1226 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698