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

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

Issue 103283003: Media Galleries API Metadata: SafeMediaMetadataParser and IPCTunnelDataReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix function definition formatting 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/ipc_data_source.h
diff --git a/chrome/utility/media_galleries/ipc_data_source.h b/chrome/utility/media_galleries/ipc_data_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..de8280a3a5fb880d896225f66d573eac5a01be83
--- /dev/null
+++ b/chrome/utility/media_galleries/ipc_data_source.h
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_
+#define CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_
+
+#include <map>
+
+#include "chrome/utility/utility_message_handler.h"
+#include "media/base/data_source.h"
+
+namespace metadata {
+
+// Provides the metadata parser with bytes from the browser process via IPC.
+class IPCDataSource: public media::DataSource,
+ public chrome::UtilityMessageHandler {
+ public:
+ explicit IPCDataSource(int64 total_size);
+ virtual ~IPCDataSource();
+
+ // Implementation of DataSource.
+ virtual void set_host(media::DataSourceHost* host) OVERRIDE;
+ virtual void Stop(const base::Closure& callback) OVERRIDE;
+ virtual void Read(int64 position, int size, uint8* data,
+ const ReadCB& read_cb) OVERRIDE;
+ virtual bool GetSize(int64* size_out) OVERRIDE;
+ virtual bool IsStreaming() OVERRIDE;
+ virtual void SetBitrate(int bitrate) OVERRIDE;
+
+ // Implementation of UtilityMessageHandler.
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ private:
+ struct Request {
+ Request();
+ ~Request();
+ uint8* destination;
+ ReadCB callback;
+ };
+
+ void OnRequestBlobBytesFinished(int64 request_id,
+ const std::string& bytes);
+
+ int64 total_size_;
Lei Zhang 2014/01/10 20:46:09 const
tommycli 2014/01/10 22:41:08 Done.
+ std::map<int64, Request> pending_requests_;
+ int64 next_request_id_;
+};
+
+} // namespace metadata
+
+#endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698