Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Side by Side Diff: content/browser/media/android/media_resource_getter_impl.cc

Issue 601043003: Speculative fix when translating blob data to a file path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/media/android/media_resource_getter_impl.h" 5 #include "content/browser/media/android/media_resource_getter_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 static void RequestPlatformPathFromBlobURL( 45 static void RequestPlatformPathFromBlobURL(
46 const GURL& url, 46 const GURL& url,
47 BrowserContext* browser_context, 47 BrowserContext* browser_context,
48 const base::Callback<void(const std::string&)>& callback) { 48 const base::Callback<void(const std::string&)>& callback) {
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
50 ChromeBlobStorageContext* context = 50 ChromeBlobStorageContext* context =
51 ChromeBlobStorageContext::GetFor(browser_context); 51 ChromeBlobStorageContext::GetFor(browser_context);
52 scoped_ptr<storage::BlobDataHandle> handle = 52 scoped_ptr<storage::BlobDataHandle> handle =
53 context->context()->GetBlobDataFromPublicURL(url); 53 context->context()->GetBlobDataFromPublicURL(url);
54 const std::vector<storage::BlobData::Item> items = handle->data()->items(); 54 storage::BlobData* data = handle->data();
55 if (!data) {
56 ReturnResultOnUIThread(callback, "");
xhwang 2014/09/25 23:11:11 If this shouldn't happen, add a NOTREACHED so that
qinmin 2014/09/26 18:48:49 Done.
57 return;
58 }
59 const std::vector<storage::BlobData::Item> items = data->items();
55 60
56 // TODO(qinmin): handle the case when the blob data is not a single file. 61 // TODO(qinmin): handle the case when the blob data is not a single file.
57 DLOG_IF(WARNING, items.size() != 1u) 62 DLOG_IF(WARNING, items.size() != 1u)
58 << "More than one blob data are present: " << items.size(); 63 << "More than one blob data are present: " << items.size();
59 ReturnResultOnUIThread(callback, items[0].path().value()); 64 ReturnResultOnUIThread(callback, items[0].path().value());
60 } 65 }
61 66
62 static void RequestPlaformPathFromFileSystemURL( 67 static void RequestPlaformPathFromFileSystemURL(
63 const GURL& url, 68 const GURL& url,
64 int render_process_id, 69 int render_process_id,
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 FROM_HERE, 365 FROM_HERE,
361 base::Bind(&GetMediaMetadataFromFd, fd, offset, size, callback)); 366 base::Bind(&GetMediaMetadataFromFd, fd, offset, size, callback));
362 } 367 }
363 368
364 // static 369 // static
365 bool MediaResourceGetterImpl::RegisterMediaResourceGetter(JNIEnv* env) { 370 bool MediaResourceGetterImpl::RegisterMediaResourceGetter(JNIEnv* env) {
366 return RegisterNativesImpl(env); 371 return RegisterNativesImpl(env);
367 } 372 }
368 373
369 } // namespace content 374 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698