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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp

Issue 2523943002: Explicitly specify target color space to ImageDecoder at creation (Closed)
Patch Set: Rebase Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "modules/notifications/NotificationImageLoader.h" 5 #include "modules/notifications/NotificationImageLoader.h"
6 6
7 #include "core/dom/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
8 #include "core/fetch/ResourceLoaderOptions.h" 8 #include "core/fetch/ResourceLoaderOptions.h"
9 #include "platform/Histogram.h" 9 #include "platform/Histogram.h"
10 #include "platform/image-decoders/ImageDecoder.h" 10 #include "platform/image-decoders/ImageDecoder.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 if (m_data) { 99 if (m_data) {
100 DEFINE_THREAD_SAFE_STATIC_LOCAL( 100 DEFINE_THREAD_SAFE_STATIC_LOCAL(
101 CustomCountHistogram, fileSizeHistogram, 101 CustomCountHistogram, fileSizeHistogram,
102 new CustomCountHistogram("Notifications.Icon.FileSize", 1, 102 new CustomCountHistogram("Notifications.Icon.FileSize", 1,
103 10000000 /* ~10mb max */, 50 /* buckets */)); 103 10000000 /* ~10mb max */, 50 /* buckets */));
104 fileSizeHistogram.count(m_data->size()); 104 fileSizeHistogram.count(m_data->size());
105 105
106 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create( 106 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(
107 m_data, true /* dataComplete */, ImageDecoder::AlphaPremultiplied, 107 m_data, true /* dataComplete */, ImageDecoder::AlphaPremultiplied,
108 ImageDecoder::ColorSpaceApplied); 108 ImageDecoder::ColorSpaceTransformed,
109 ImageDecoder::globalTargetColorSpace());
109 if (decoder) { 110 if (decoder) {
110 // The |ImageFrame*| is owned by the decoder. 111 // The |ImageFrame*| is owned by the decoder.
111 ImageFrame* imageFrame = decoder->frameBufferAtIndex(0); 112 ImageFrame* imageFrame = decoder->frameBufferAtIndex(0);
112 if (imageFrame) { 113 if (imageFrame) {
113 (*m_imageCallback)(imageFrame->bitmap()); 114 (*m_imageCallback)(imageFrame->bitmap());
114 return; 115 return;
115 } 116 }
116 } 117 }
117 } 118 }
118 runCallbackWithEmptyBitmap(); 119 runCallbackWithEmptyBitmap();
(...skipping 17 matching lines...) Expand all
136 void NotificationImageLoader::runCallbackWithEmptyBitmap() { 137 void NotificationImageLoader::runCallbackWithEmptyBitmap() {
137 // If this has been stopped it is not desirable to trigger further work, 138 // If this has been stopped it is not desirable to trigger further work,
138 // there is a shutdown of some sort in progress. 139 // there is a shutdown of some sort in progress.
139 if (m_stopped) 140 if (m_stopped)
140 return; 141 return;
141 142
142 (*m_imageCallback)(SkBitmap()); 143 (*m_imageCallback)(SkBitmap());
143 } 144 }
144 145
145 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698