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

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

Issue 2454123002: Refactor image decoders to use 'colorSpace' instead of 'colorProfile' (Closed)
Patch Set: Fix legacy ImageFrame Created 4 years, 1 month 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::GammaAndColorProfileApplied); 108 ImageDecoder::ColorSpaceApplied);
109 if (decoder) { 109 if (decoder) {
110 // The |ImageFrame*| is owned by the decoder. 110 // The |ImageFrame*| is owned by the decoder.
111 ImageFrame* imageFrame = decoder->frameBufferAtIndex(0); 111 ImageFrame* imageFrame = decoder->frameBufferAtIndex(0);
112 if (imageFrame) { 112 if (imageFrame) {
113 (*m_imageCallback)(imageFrame->bitmap()); 113 (*m_imageCallback)(imageFrame->bitmap());
114 return; 114 return;
115 } 115 }
116 } 116 }
117 } 117 }
118 runCallbackWithEmptyBitmap(); 118 runCallbackWithEmptyBitmap();
(...skipping 17 matching lines...) Expand all
136 void NotificationImageLoader::runCallbackWithEmptyBitmap() { 136 void NotificationImageLoader::runCallbackWithEmptyBitmap() {
137 // If this has been stopped it is not desirable to trigger further work, 137 // If this has been stopped it is not desirable to trigger further work,
138 // there is a shutdown of some sort in progress. 138 // there is a shutdown of some sort in progress.
139 if (m_stopped) 139 if (m_stopped)
140 return; 140 return;
141 141
142 (*m_imageCallback)(SkBitmap()); 142 (*m_imageCallback)(SkBitmap());
143 } 143 }
144 144
145 } // namespace blink 145 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698