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

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 1409243005: Make ImageBitmap Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Even more on OilPan compatible issue Created 5 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "config.h" 5 #include "config.h"
6 #include "core/frame/ImageBitmap.h" 6 #include "core/frame/ImageBitmap.h"
7 7
8 #include "core/html/HTMLCanvasElement.h" 8 #include "core/html/HTMLCanvasElement.h"
9 #include "core/html/HTMLVideoElement.h" 9 #include "core/html/HTMLVideoElement.h"
10 #include "core/html/ImageData.h" 10 #include "core/html/ImageData.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 IntRect normalizedCropRect = normalizeRect(cropRect); 174 IntRect normalizedCropRect = normalizeRect(cropRect);
175 return adoptRefWillBeNoop(new ImageBitmap(bitmap, normalizedCropRect)); 175 return adoptRefWillBeNoop(new ImageBitmap(bitmap, normalizedCropRect));
176 } 176 }
177 177
178 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(Image* image, const IntR ect& cropRect) 178 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(Image* image, const IntR ect& cropRect)
179 { 179 {
180 IntRect normalizedCropRect = normalizeRect(cropRect); 180 IntRect normalizedCropRect = normalizeRect(cropRect);
181 return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect)); 181 return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect));
182 } 182 }
183 183
184 void ImageBitmap::neuter()
Justin Novosad 2015/10/24 03:04:48 I don't see why neuter and transfer need to be sep
xidachen 2015/10/24 20:36:25 That makes perfect sense. They are now merged into
185 {
186 if (m_imageElement)
187 m_imageElement.clear();
188 if (m_bitmap)
189 m_bitmap.clear();
190 }
191
192 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::transfer()
193 {
194 return adoptRefWillBeNoop(new ImageBitmap(this, m_cropRect));
195 }
196
184 void ImageBitmap::notifyImageSourceChanged() 197 void ImageBitmap::notifyImageSourceChanged()
185 { 198 {
186 m_bitmap = cropImage(m_imageElement->cachedImage()->image(), m_cropRect); 199 m_bitmap = cropImage(m_imageElement->cachedImage()->image(), m_cropRect);
187 m_bitmapOffset = IntPoint(); 200 m_bitmapOffset = IntPoint();
188 m_imageElement = nullptr; 201 m_imageElement = nullptr;
189 } 202 }
190 203
191 PassRefPtr<Image> ImageBitmap::bitmapImage() const 204 PassRefPtr<Image> ImageBitmap::bitmapImage() const
192 { 205 {
193 ASSERT((m_imageElement || m_bitmap || !m_bitmapRect.width() || !m_bitmapRect .height()) && (!m_imageElement || !m_bitmap)); 206 ASSERT((m_imageElement || m_bitmap || !m_bitmapRect.width() || !m_bitmapRect .height()) && (!m_imageElement || !m_bitmap));
(...skipping 26 matching lines...) Expand all
220 return FloatSize(width(), height()); 233 return FloatSize(width(), height());
221 } 234 }
222 235
223 DEFINE_TRACE(ImageBitmap) 236 DEFINE_TRACE(ImageBitmap)
224 { 237 {
225 visitor->trace(m_imageElement); 238 visitor->trace(m_imageElement);
226 ImageLoaderClient::trace(visitor); 239 ImageLoaderClient::trace(visitor);
227 } 240 }
228 241
229 } // namespace blink 242 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/ImageBitmap.h ('k') | third_party/WebKit/Source/web/WebSerializedScriptValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698