OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |