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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 void NotificationImageLoader::stop() | 60 void NotificationImageLoader::stop() |
61 { | 61 { |
62 if (m_stopped) | 62 if (m_stopped) |
63 return; | 63 return; |
64 | 64 |
65 m_stopped = true; | 65 m_stopped = true; |
66 if (m_threadableLoader) { | 66 if (m_threadableLoader) { |
67 m_threadableLoader->cancel(); | 67 m_threadableLoader->cancel(); |
68 // WorkerThreadableLoader keeps a Persistent<WorkerGlobalScope> to the | 68 m_threadableLoader = nullptr; |
69 // ExecutionContext it received in |create|. Kill it to prevent | |
70 // reference cycles involving a mix of GC and non-GC types that fail to | |
71 // clear in ThreadState::cleanup. | |
72 m_threadableLoader.reset(); | |
73 } | 69 } |
74 } | 70 } |
75 | 71 |
76 void NotificationImageLoader::didReceiveData(const char* data, unsigned length) | 72 void NotificationImageLoader::didReceiveData(const char* data, unsigned length) |
77 { | 73 { |
78 if (!m_data) | 74 if (!m_data) |
79 m_data = SharedBuffer::create(); | 75 m_data = SharedBuffer::create(); |
80 m_data->append(data, length); | 76 m_data->append(data, length); |
81 } | 77 } |
82 | 78 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 { | 121 { |
126 // If this has been stopped it is not desirable to trigger further work, | 122 // If this has been stopped it is not desirable to trigger further work, |
127 // there is a shutdown of some sort in progress. | 123 // there is a shutdown of some sort in progress. |
128 if (m_stopped) | 124 if (m_stopped) |
129 return; | 125 return; |
130 | 126 |
131 (*m_imageCallback)(SkBitmap()); | 127 (*m_imageCallback)(SkBitmap()); |
132 } | 128 } |
133 | 129 |
134 } // namespace blink | 130 } // namespace blink |
OLD | NEW |