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

Unified Diff: chrome/utility/media_galleries/media_metadata_parser.h

Issue 103283003: Media Galleries API Metadata: SafeMediaMetadataParser and IPCTunnelDataReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ownership issues Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/utility/media_galleries/media_metadata_parser.h
diff --git a/chrome/utility/media_galleries/media_metadata_parser.h b/chrome/utility/media_galleries/media_metadata_parser.h
index 5a0573aa504c499d21cc98cf6dcf5d743120a67e..20192852497aa93295dc428e303796b814e76255 100644
--- a/chrome/utility/media_galleries/media_metadata_parser.h
+++ b/chrome/utility/media_galleries/media_metadata_parser.h
@@ -9,19 +9,11 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/api/media_galleries.h"
-namespace metadata {
-
-// This interface provides bytes needed by MediaMetadataParser.
-class DataReader {
- public:
- typedef base::Callback<void(const std::string& bytes)> ReadBytesCallback;
+namespace media {
+class DataSource;
+}
- virtual ~DataReader() {}
-
- // Called on the utility thread.
- virtual void ReadBytes(int64 offset, int64 length,
- const ReadBytesCallback& callback) = 0;
-};
+namespace metadata {
// This class takes a MIME type and data source and parses its metadata. It
// handles audio, video, and images. It delegates its operations to FFMPEG,
@@ -33,10 +25,10 @@ class MediaMetadataParser {
typedef extensions::api::media_galleries::MediaMetadata MediaMetadata;
typedef base::Callback<void(scoped_ptr<MediaMetadata>)> MetadataCallback;
- // Takes ownership of |reader|. The MIME type is always sniffed in the browser
- // process, as it's faster (and safe enough) to sniff it there. When the user
- // wants more metadata than just the MIME type, this class provides it.
- MediaMetadataParser(DataReader* reader, const std::string& mime_type);
+ // Does not take ownership of |source|. The MIME type is sniffed in the
vandebo (ex-Chrome) 2014/01/07 18:34:59 You should say more explicitly that the caller is
tommycli 2014/01/07 20:23:31 Done.
+ // browser process, as it's faster (and safe enough). When the user wants
vandebo (ex-Chrome) 2014/01/07 18:34:59 I think you can omit the stuff about mime type - t
tommycli 2014/01/07 20:23:31 Done.
+ // more metadata than just the MIME type, this class provides it.
+ MediaMetadataParser(media::DataSource* source, const std::string& mime_type);
~MediaMetadataParser();
@@ -44,7 +36,7 @@ class MediaMetadataParser {
void Start(const MetadataCallback& callback);
private:
- scoped_ptr<DataReader> reader_;
+ media::DataSource* source_;
MetadataCallback callback_;

Powered by Google App Engine
This is Rietveld 408576698