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

Side by Side Diff: Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

Issue 7888057: Merge 94982 - [chromium] Prevent a crash when tearing down an ImageBuffer that was not successfu... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 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) 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 } 110 }
111 } 111 }
112 } 112 }
113 113
114 success = true; 114 success = true;
115 } 115 }
116 116
117 ImageBuffer::~ImageBuffer() 117 ImageBuffer::~ImageBuffer()
118 { 118 {
119 // This is so that the SkGpuDevice destructor has the correct context. 119 if (m_context && m_context->platformContext()) {
120 m_context->platformContext()->makeGrContextCurrent(); 120 // This is so that the SkGpuDevice destructor has the correct context.
121 m_context->platformContext()->makeGrContextCurrent();
122 }
121 } 123 }
122 124
123 GraphicsContext* ImageBuffer::context() const 125 GraphicsContext* ImageBuffer::context() const
124 { 126 {
125 return m_context.get(); 127 return m_context.get();
126 } 128 }
127 129
128 size_t ImageBuffer::dataSize() const 130 size_t ImageBuffer::dataSize() const
129 { 131 {
130 return m_size.width() * m_size.height() * 4; 132 return m_size.width() * m_size.height() * 4;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 SkDevice* device = context()->platformContext()->canvas()->getDevice(); 405 SkDevice* device = context()->platformContext()->canvas()->getDevice();
404 return ImageToDataURL(device->accessBitmap(false), mimeType, quality); 406 return ImageToDataURL(device->accessBitmap(false), mimeType, quality);
405 } 407 }
406 408
407 String ImageDataToDataURL(const ImageData& source, const String& mimeType, const double* quality) 409 String ImageDataToDataURL(const ImageData& source, const String& mimeType, const double* quality)
408 { 410 {
409 return ImageToDataURL(source, mimeType, quality); 411 return ImageToDataURL(source, mimeType, quality);
410 } 412 }
411 413
412 } // namespace WebCore 414 } // namespace WebCore
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