| 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 m_threadableLoader = nullptr; | 68 // WorkerThreadableLoader keeps a Persistent<WorkerGlobalScope> to the |
| 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(); |
| 69 } | 73 } |
| 70 } | 74 } |
| 71 | 75 |
| 72 void NotificationImageLoader::didReceiveData(const char* data, unsigned length) | 76 void NotificationImageLoader::didReceiveData(const char* data, unsigned length) |
| 73 { | 77 { |
| 74 if (!m_data) | 78 if (!m_data) |
| 75 m_data = SharedBuffer::create(); | 79 m_data = SharedBuffer::create(); |
| 76 m_data->append(data, length); | 80 m_data->append(data, length); |
| 77 } | 81 } |
| 78 | 82 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 { | 125 { |
| 122 // 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, |
| 123 // there is a shutdown of some sort in progress. | 127 // there is a shutdown of some sort in progress. |
| 124 if (m_stopped) | 128 if (m_stopped) |
| 125 return; | 129 return; |
| 126 | 130 |
| 127 (*m_imageCallback)(SkBitmap()); | 131 (*m_imageCallback)(SkBitmap()); |
| 128 } | 132 } |
| 129 | 133 |
| 130 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |