Chromium Code Reviews| Index: chrome/utility/media_galleries/ipc_tunnel_data_source.h |
| diff --git a/chrome/utility/media_galleries/ipc_tunnel_data_source.h b/chrome/utility/media_galleries/ipc_tunnel_data_source.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..47b9683bfcd0af1275bcced3e27ae0dbbc051b44 |
| --- /dev/null |
| +++ b/chrome/utility/media_galleries/ipc_tunnel_data_source.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2013 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_TUNNEL_DATA_SOURCE_H_ |
| +#define CHROME_UTILITY_MEDIA_GALLERIES_IPC_TUNNEL_DATA_SOURCE_H_ |
| + |
| +#include <map> |
| + |
| +#include "media/base/data_source.h" |
| + |
| +namespace metadata { |
| + |
| +// Provides the metadata parser with bytes from the browser process via IPC. |
| +class IPCTunnelDataSource : public media::DataSource { |
|
vandebo (ex-Chrome)
2014/01/07 18:34:59
IPCDataSource is probably a sufficient name.
tommycli
2014/01/07 20:23:31
Done.
|
| + public: |
| + explicit IPCTunnelDataSource(int64 total_size); |
| + virtual ~IPCTunnelDataSource(); |
| + |
| + // 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; |
| + |
| + // Called by ChromeContentUtilityClient when it recieves the requested bytes. |
| + void ReceiveBytes(int64 request_id, const std::string& bytes); |
| + |
| + private: |
| + struct Request { |
| + Request(); |
| + ~Request(); |
| + uint8* destination; |
| + ReadCB callback; |
| + }; |
| + |
| + int64 total_size_; |
| + std::map<int64, Request> pending_requests_; |
| + int64 next_request_id_; |
| +}; |
| + |
| +} // namespace metadata |
| + |
| +#endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_TUNNEL_DATA_SOURCE_H_ |