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

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

Issue 2667443002: Convert utility process ParseMediaMetadata blob reading IPC to mojo (Closed)
Patch Set: Remove the damn helper: call ReleaseProcessIfNeeded directly. Created 3 years, 10 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
index c859f03c4c3d30844030b0cea73e4a7f2648734e..932743eb191545f393d34c7803a5520aab705cab 100644
--- a/chrome/utility/media_galleries/ipc_data_source.h
+++ b/chrome/utility/media_galleries/ipc_data_source.h
@@ -12,7 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/threading/thread_checker.h"
-#include "chrome/utility/utility_message_handler.h"
+#include "chrome/common/extensions/media_parser.mojom.h"
#include "media/base/data_source.h"
namespace base {
@@ -21,18 +21,18 @@ class TaskRunner;
namespace metadata {
-// Provides the metadata parser with bytes from the browser process via IPC.
-// Class must be created and destroyed on the utility thread. Class may be used
-// as a DataSource on a different thread. The utility thread must not be blocked
+// Provides the metadata parser with blob data from the browser process. Class
+// must be created and destroyed on the utility thread. Class may be used as a
+// DataSource on a different thread. The utility thread must not be blocked
// for read operations to succeed.
-class IPCDataSource: public media::DataSource,
- public UtilityMessageHandler {
+class IPCDataSource : public media::DataSource {
public:
// May only be called on the utility thread.
- explicit IPCDataSource(int64_t total_size);
+ IPCDataSource(extensions::mojom::MediaDataSourcePtr media_data_source,
+ int64_t total_size);
~IPCDataSource() override;
- // Implementation of DataSource. These methods may be called on any single
+ // media::DataSource implementation. The methods may be called on any single
// thread. First usage of these methods attaches a thread checker.
void Stop() override;
void Abort() override;
@@ -44,26 +44,17 @@ class IPCDataSource: public media::DataSource,
bool IsStreaming() override;
void SetBitrate(int bitrate) override;
- // Implementation of UtilityMessageHandler. May only be called on the utility
- // thread.
- bool OnMessageReceived(const IPC::Message& message) override;
-
private:
- struct Request {
- Request();
- Request(const Request& other);
- ~Request();
- uint8_t* destination;
- ReadCB callback;
- };
-
- void ReadOnUtilityThread(int64_t position,
- int size,
- uint8_t* data,
- const ReadCB& read_cb);
+ struct Request;
- void OnRequestBlobBytesFinished(int64_t request_id, const std::string& bytes);
+ // Blob data read helpers: must be run on the utility thread.
+ void ReadBlob(int64_t position,
+ int size,
+ uint8_t* data,
+ const ReadCB& read_cb);
+ void ReadDone(int64_t request_id, const std::vector<uint8_t>& data);
+ extensions::mojom::MediaDataSourcePtr media_data_source_;
const int64_t total_size_;
scoped_refptr<base::TaskRunner> utility_task_runner_;

Powered by Google App Engine
This is Rietveld 408576698