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