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

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: add NOTREACHED 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, "");
57 NOTREACHED();
58 return;
59 }
60 const std::vector<storage::BlobData::Item> items = data->items();
55 61
56 // TODO(qinmin): handle the case when the blob data is not a single file. 62 // TODO(qinmin): handle the case when the blob data is not a single file.
57 DLOG_IF(WARNING, items.size() != 1u) 63 DLOG_IF(WARNING, items.size() != 1u)
58 << "More than one blob data are present: " << items.size(); 64 << "More than one blob data are present: " << items.size();
59 ReturnResultOnUIThread(callback, items[0].path().value()); 65 ReturnResultOnUIThread(callback, items[0].path().value());
60 } 66 }
61 67
62 static void RequestPlaformPathFromFileSystemURL( 68 static void RequestPlaformPathFromFileSystemURL(
63 const GURL& url, 69 const GURL& url,
64 int render_process_id, 70 int render_process_id,
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 FROM_HERE, 366 FROM_HERE,
361 base::Bind(&GetMediaMetadataFromFd, fd, offset, size, callback)); 367 base::Bind(&GetMediaMetadataFromFd, fd, offset, size, callback));
362 } 368 }
363 369
364 // static 370 // static
365 bool MediaResourceGetterImpl::RegisterMediaResourceGetter(JNIEnv* env) { 371 bool MediaResourceGetterImpl::RegisterMediaResourceGetter(JNIEnv* env) {
366 return RegisterNativesImpl(env); 372 return RegisterNativesImpl(env);
367 } 373 }
368 374
369 } // namespace content 375 } // 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