| Index: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp | 
| diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp | 
| index 80d9482b1ad892bd8a88d69a286dbfa96fa314f8..03d5fcdfe8f852a6265d8fed1e7e59757a87ab4c 100644 | 
| --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp | 
| +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp | 
| @@ -31,12 +31,15 @@ | 
| #include "platform/Timer.h" | 
| #include "platform/TraceEvent.h" | 
| #include "platform/geometry/FloatRect.h" | 
| +#include "platform/graphics/ColorSpaceProfile.h" | 
| #include "platform/graphics/DeferredImageDecoder.h" | 
| +#include "platform/graphics/GraphicsScreen.h" | 
| #include "platform/graphics/ImageObserver.h" | 
| #include "platform/graphics/StaticBitmapImage.h" | 
| #include "platform/graphics/skia/SkiaUtils.h" | 
| #include "third_party/skia/include/core/SkCanvas.h" | 
| #include "wtf/PassRefPtr.h" | 
| +#include "wtf/RefPtr.h" | 
| #include "wtf/text/WTFString.h" | 
|  | 
| namespace blink { | 
| @@ -70,6 +73,7 @@ BitmapImage::BitmapImage(ImageObserver* observer) | 
| , m_hasUniformFrameSize(true) | 
| , m_haveFrameCount(false) | 
| { | 
| +    fprintf(stderr, "BitmapImage %p created (page %ld)\n", this, (long int)currentScreenId()); | 
| } | 
|  | 
| BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) | 
| @@ -161,6 +165,7 @@ void BitmapImage::cacheFrame(size_t index) | 
|  | 
| int deltaBytes = totalFrameBytes(); | 
|  | 
| +    fprintf(stderr, "BitmapImage %p cacheframe(index=%d)\n", this, (int)index); | 
|  | 
| // We are caching frame snapshots.  This is OK even for partially decoded frames, | 
| // as they are cleared by dataChanged() when new data arrives. | 
| @@ -269,6 +274,9 @@ void BitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& | 
| { | 
| TRACE_EVENT0("skia", "BitmapImage::draw"); | 
|  | 
| +    if (imageColorProfilesEnabled() && hasColorProfile()) | 
| +        notifyDeviceProfile(screenColorProfile(currentScreenId()).get()); | 
| + | 
| RefPtr<SkImage> image = imageForCurrentFrame(); | 
| if (!image) | 
| return; // It's too early and we don't have an image yet. | 
| @@ -670,4 +678,30 @@ bool BitmapImage::internalAdvanceAnimation(bool skippingFrames) | 
| return advancedAnimation; | 
| } | 
|  | 
| +void BitmapImage::notifyDeviceProfile(ColorSpaceProfile* deviceProfile) | 
| +{ | 
| +    RELEASE_ASSERT(imageColorProfilesEnabled() && hasColorProfile()); | 
| + | 
| +    if (m_source.deviceProfile() == deviceProfile) | 
| +        return; | 
| + | 
| +    if (!imageObserver()) | 
| +        return; | 
| + | 
| +    imageObserver()->deviceProfileChanged(this, deviceProfile); | 
| +} | 
| + | 
| +bool BitmapImage::resetDecoder(ColorSpaceProfile* deviceProfile) | 
| +{ | 
| +    RELEASE_ASSERT(imageColorProfilesEnabled() && hasColorProfile()); | 
| + | 
| +    if (m_source.deviceProfile() == deviceProfile) | 
| +        return false; | 
| + | 
| +    fprintf(stderr, "BitmapImage %p resetDecoder\n", this); | 
| +    m_source.resetDecoder(); | 
| +    m_source.setDeviceProfile(deviceProfile); | 
| +    return true; | 
| +} | 
| + | 
| } // namespace blink | 
|  |