Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_IPC_TUNNEL_DATA_SOURCE_H_ | |
| 6 #define CHROME_UTILITY_MEDIA_GALLERIES_IPC_TUNNEL_DATA_SOURCE_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "media/base/data_source.h" | |
| 11 | |
| 12 namespace metadata { | |
| 13 | |
| 14 // Provides the metadata parser with bytes from the browser process via IPC. | |
| 15 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.
| |
| 16 public: | |
| 17 explicit IPCTunnelDataSource(int64 total_size); | |
| 18 virtual ~IPCTunnelDataSource(); | |
| 19 | |
| 20 // Implementation of DataSource. | |
| 21 virtual void set_host(media::DataSourceHost* host) OVERRIDE; | |
| 22 virtual void Stop(const base::Closure& callback) OVERRIDE; | |
| 23 virtual void Read(int64 position, int size, uint8* data, | |
| 24 const ReadCB& read_cb) OVERRIDE; | |
| 25 virtual bool GetSize(int64* size_out) OVERRIDE; | |
| 26 virtual bool IsStreaming() OVERRIDE; | |
| 27 virtual void SetBitrate(int bitrate) OVERRIDE; | |
| 28 | |
| 29 // Called by ChromeContentUtilityClient when it recieves the requested bytes. | |
| 30 void ReceiveBytes(int64 request_id, const std::string& bytes); | |
| 31 | |
| 32 private: | |
| 33 struct Request { | |
| 34 Request(); | |
| 35 ~Request(); | |
| 36 uint8* destination; | |
| 37 ReadCB callback; | |
| 38 }; | |
| 39 | |
| 40 int64 total_size_; | |
| 41 std::map<int64, Request> pending_requests_; | |
| 42 int64 next_request_id_; | |
| 43 }; | |
| 44 | |
| 45 } // namespace metadata | |
| 46 | |
| 47 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_TUNNEL_DATA_SOURCE_H_ | |
| OLD | NEW |