| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 ResourceLoaderOptions resourceLoaderOptions; | 113 ResourceLoaderOptions resourceLoaderOptions; |
| 114 resourceLoaderOptions.allowCredentials = AllowStoredCredentials; | 114 resourceLoaderOptions.allowCredentials = AllowStoredCredentials; |
| 115 if (executionContext->isWorkerGlobalScope()) | 115 if (executionContext->isWorkerGlobalScope()) |
| 116 resourceLoaderOptions.requestInitiatorContext = WorkerContext; | 116 resourceLoaderOptions.requestInitiatorContext = WorkerContext; |
| 117 | 117 |
| 118 ResourceRequest resourceRequest(url); | 118 ResourceRequest resourceRequest(url); |
| 119 resourceRequest.setRequestContext(WebURLRequest::RequestContextImage); | 119 resourceRequest.setRequestContext(WebURLRequest::RequestContextImage); |
| 120 resourceRequest.setPriority(ResourceLoadPriorityMedium); | 120 resourceRequest.setPriority(ResourceLoadPriorityMedium); |
| 121 resourceRequest.setRequestorOrigin(executionContext->getSecurityOrigin()); | 121 resourceRequest.setRequestorOrigin(executionContext->getSecurityOrigin()); |
| 122 | 122 |
| 123 // TODO(yhirano): Remove this CHECK once https://crbug.com/667254 is fixed. |
| 124 CHECK(!m_threadableLoader); |
| 123 m_threadableLoader = ThreadableLoader::create( | 125 m_threadableLoader = ThreadableLoader::create( |
| 124 *executionContext, this, threadableLoaderOptions, resourceLoaderOptions); | 126 *executionContext, this, threadableLoaderOptions, resourceLoaderOptions); |
| 125 m_threadableLoader->start(resourceRequest); | 127 m_threadableLoader->start(resourceRequest); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void NotificationImageLoader::stop() { | 130 void NotificationImageLoader::stop() { |
| 129 if (m_stopped) | 131 if (m_stopped) |
| 130 return; | 132 return; |
| 131 | 133 |
| 132 m_stopped = true; | 134 m_stopped = true; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void NotificationImageLoader::runCallbackWithEmptyBitmap() { | 190 void NotificationImageLoader::runCallbackWithEmptyBitmap() { |
| 189 // If this has been stopped it is not desirable to trigger further work, | 191 // If this has been stopped it is not desirable to trigger further work, |
| 190 // there is a shutdown of some sort in progress. | 192 // there is a shutdown of some sort in progress. |
| 191 if (m_stopped) | 193 if (m_stopped) |
| 192 return; | 194 return; |
| 193 | 195 |
| 194 (*m_imageCallback)(SkBitmap()); | 196 (*m_imageCallback)(SkBitmap()); |
| 195 } | 197 } |
| 196 | 198 |
| 197 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |