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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (m_stopped) | 87 if (m_stopped) |
88 return; | 88 return; |
89 | 89 |
90 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, finishedTimeHistogram,
new CustomCountHistogram("Notifications.Icon.LoadFinishTime", 1, 1000 * 60 * 60
/* 1 hour max */, 50 /* buckets */)); | 90 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, finishedTimeHistogram,
new CustomCountHistogram("Notifications.Icon.LoadFinishTime", 1, 1000 * 60 * 60
/* 1 hour max */, 50 /* buckets */)); |
91 finishedTimeHistogram.count(monotonicallyIncreasingTimeMS() - m_startTime); | 91 finishedTimeHistogram.count(monotonicallyIncreasingTimeMS() - m_startTime); |
92 | 92 |
93 if (m_data) { | 93 if (m_data) { |
94 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, fileSizeHistogram,
new CustomCountHistogram("Notifications.Icon.FileSize", 1, 10000000 /* ~10mb ma
x */, 50 /* buckets */)); | 94 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, fileSizeHistogram,
new CustomCountHistogram("Notifications.Icon.FileSize", 1, 10000000 /* ~10mb ma
x */, 50 /* buckets */)); |
95 fileSizeHistogram.count(m_data->size()); | 95 fileSizeHistogram.count(m_data->size()); |
96 | 96 |
97 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*m_data.get
(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied)
; | 97 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(ImageDecode
r::determineImageType(*m_data.get()), ImageDecoder::AlphaPremultiplied, ImageDec
oder::GammaAndColorProfileApplied); |
98 if (decoder) { | 98 if (decoder) { |
99 decoder->setData(m_data.get(), true /* allDataReceived */); | 99 decoder->setData(m_data.get(), true /* allDataReceived */); |
100 // The |ImageFrame*| is owned by the decoder. | 100 // The |ImageFrame*| is owned by the decoder. |
101 ImageFrame* imageFrame = decoder->frameBufferAtIndex(0); | 101 ImageFrame* imageFrame = decoder->frameBufferAtIndex(0); |
102 if (imageFrame) { | 102 if (imageFrame) { |
103 (*m_imageCallback)(imageFrame->bitmap()); | 103 (*m_imageCallback)(imageFrame->bitmap()); |
104 return; | 104 return; |
105 } | 105 } |
106 } | 106 } |
107 } | 107 } |
(...skipping 17 matching lines...) Expand all Loading... |
125 { | 125 { |
126 // If this has been stopped it is not desirable to trigger further work, | 126 // If this has been stopped it is not desirable to trigger further work, |
127 // there is a shutdown of some sort in progress. | 127 // there is a shutdown of some sort in progress. |
128 if (m_stopped) | 128 if (m_stopped) |
129 return; | 129 return; |
130 | 130 |
131 (*m_imageCallback)(SkBitmap()); | 131 (*m_imageCallback)(SkBitmap()); |
132 } | 132 } |
133 | 133 |
134 } // namespace blink | 134 } // namespace blink |
OLD | NEW |