| Index: content/browser/media/android/media_resource_getter_impl.cc
|
| diff --git a/content/browser/media/android/media_resource_getter_impl.cc b/content/browser/media/android/media_resource_getter_impl.cc
|
| index 7083da4e435d55a390854495b5367de3b0868c07..686e01c331c43ca5535f49931315006fafe1ccf8 100644
|
| --- a/content/browser/media/android/media_resource_getter_impl.cc
|
| +++ b/content/browser/media/android/media_resource_getter_impl.cc
|
| @@ -12,6 +12,7 @@
|
| #include "content/browser/child_process_security_policy_impl.h"
|
| #include "content/browser/fileapi/browser_file_system_helper.h"
|
| #include "content/browser/fileapi/chrome_blob_storage_context.h"
|
| +#include "content/browser/resource_context_impl.h"
|
| #include "content/public/browser/browser_context.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/content_browser_client.h"
|
| @@ -44,16 +45,23 @@ static void ReturnResultOnUIThread(
|
|
|
| static void RequestPlatformPathFromBlobURL(
|
| const GURL& url,
|
| - BrowserContext* browser_context,
|
| + ResourceContext* resource_context,
|
| const base::Callback<void(const std::string&)>& callback) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - ChromeBlobStorageContext* context =
|
| - ChromeBlobStorageContext::GetFor(browser_context);
|
| + ChromeBlobStorageContext* blob_storage_context =
|
| + GetChromeBlobStorageContextForResourceContext(resource_context);
|
| +
|
| scoped_ptr<storage::BlobDataHandle> handle =
|
| - context->context()->GetBlobDataFromPublicURL(url);
|
| + blob_storage_context->context()->GetBlobDataFromPublicURL(url);
|
| + if (!handle) {
|
| + // There are plenty of cases where handle can be empty. The most trivial is
|
| + // when JS has aready revoked the given blob URL via URL.revokeObjectURL
|
| + ReturnResultOnUIThread(callback, std::string());
|
| + return;
|
| + }
|
| storage::BlobData* data = handle->data();
|
| if (!data) {
|
| - ReturnResultOnUIThread(callback, "");
|
| + ReturnResultOnUIThread(callback, std::string());
|
| NOTREACHED();
|
| return;
|
| }
|
| @@ -329,7 +337,8 @@ void MediaResourceGetterImpl::GetPlatformPathFromURL(
|
| BrowserThread::PostTask(
|
| BrowserThread::IO,
|
| FROM_HERE,
|
| - base::Bind(&RequestPlatformPathFromBlobURL, url, browser_context_, cb));
|
| + base::Bind(&RequestPlatformPathFromBlobURL, url,
|
| + browser_context_->GetResourceContext(), cb));
|
| return;
|
| }
|
|
|
|
|