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

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

Issue 1532473002: Add a origin clean flag in ImageBitmap class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: take care of single security origin Created 4 years, 11 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 /* 1 /*
2 * Copyright (c) 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2008, Google Inc. All rights reserved.
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
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 are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (!isSurfaceValid()) 153 if (!isSurfaceValid())
154 return nullptr; 154 return nullptr;
155 return m_surface->newImageSnapshot(hint); 155 return m_surface->newImageSnapshot(hint);
156 } 156 }
157 157
158 PassRefPtr<Image> ImageBuffer::newImageSnapshot(AccelerationHint hint) const 158 PassRefPtr<Image> ImageBuffer::newImageSnapshot(AccelerationHint hint) const
159 { 159 {
160 RefPtr<SkImage> snapshot = newSkImageSnapshot(hint); 160 RefPtr<SkImage> snapshot = newSkImageSnapshot(hint);
161 if (!snapshot) 161 if (!snapshot)
162 return nullptr; 162 return nullptr;
163 return StaticBitmapImage::create(snapshot); 163 return StaticBitmapImage::create(snapshot, hasSingleSecurityOrigin() ? HasSi ngleSecurityOrigin : NoSingleSecurityOrigin);
164 } 164 }
165 165
166 void ImageBuffer::didDraw(const FloatRect& rect) const 166 void ImageBuffer::didDraw(const FloatRect& rect) const
167 { 167 {
168 if (m_snapshotState == DidAcquireSnapshot) 168 if (m_snapshotState == DidAcquireSnapshot)
169 m_snapshotState = DrawnToAfterSnapshot; 169 m_snapshotState = DrawnToAfterSnapshot;
170 m_surface->didDraw(rect); 170 m_surface->didDraw(rect);
171 } 171 }
172 172
173 bool ImageBuffer::hasSingleSecurityOrigin() const
174 {
175 return m_client->hasSingleSecurityOrigin();
176 }
177
173 WebLayer* ImageBuffer::platformLayer() const 178 WebLayer* ImageBuffer::platformLayer() const
174 { 179 {
175 return m_surface->layer(); 180 return m_surface->layer();
176 } 181 }
177 182
178 bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3 DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premu ltiplyAlpha, bool flipY) 183 bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3 DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premu ltiplyAlpha, bool flipY)
179 { 184 {
180 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalForm at, destType, level)) 185 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalForm at, destType, level))
181 return false; 186 return false;
182 187
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); 402 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
398 403
399 Vector<unsigned char> result; 404 Vector<unsigned char> result;
400 if (!encodeImage(mimeType, quality, &result)) 405 if (!encodeImage(mimeType, quality, &result))
401 return "data:,"; 406 return "data:,";
402 407
403 return "data:" + mimeType + ";base64," + base64Encode(result); 408 return "data:" + mimeType + ";base64," + base64Encode(result);
404 } 409 }
405 410
406 } // namespace blink 411 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698