OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ | 5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ |
6 #define CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ | 6 #define CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 bool IsStreaming() override; | 43 bool IsStreaming() override; |
44 void SetBitrate(int bitrate) override; | 44 void SetBitrate(int bitrate) override; |
45 | 45 |
46 // Implementation of UtilityMessageHandler. May only be called on the utility | 46 // Implementation of UtilityMessageHandler. May only be called on the utility |
47 // thread. | 47 // thread. |
48 bool OnMessageReceived(const IPC::Message& message) override; | 48 bool OnMessageReceived(const IPC::Message& message) override; |
49 | 49 |
50 private: | 50 private: |
51 struct Request { | 51 struct Request { |
52 Request(); | 52 Request(); |
| 53 Request(const Request& other); |
53 ~Request(); | 54 ~Request(); |
54 uint8_t* destination; | 55 uint8_t* destination; |
55 ReadCB callback; | 56 ReadCB callback; |
56 }; | 57 }; |
57 | 58 |
58 void ReadOnUtilityThread(int64_t position, | 59 void ReadOnUtilityThread(int64_t position, |
59 int size, | 60 int size, |
60 uint8_t* data, | 61 uint8_t* data, |
61 const ReadCB& read_cb); | 62 const ReadCB& read_cb); |
62 | 63 |
63 void OnRequestBlobBytesFinished(int64_t request_id, const std::string& bytes); | 64 void OnRequestBlobBytesFinished(int64_t request_id, const std::string& bytes); |
64 | 65 |
65 const int64_t total_size_; | 66 const int64_t total_size_; |
66 | 67 |
67 scoped_refptr<base::TaskRunner> utility_task_runner_; | 68 scoped_refptr<base::TaskRunner> utility_task_runner_; |
68 std::map<int64_t, Request> pending_requests_; | 69 std::map<int64_t, Request> pending_requests_; |
69 int64_t next_request_id_; | 70 int64_t next_request_id_; |
70 | 71 |
71 base::ThreadChecker utility_thread_checker_; | 72 base::ThreadChecker utility_thread_checker_; |
72 | 73 |
73 // Enforces that the DataSource methods are called on one other thread only. | 74 // Enforces that the DataSource methods are called on one other thread only. |
74 base::ThreadChecker data_source_thread_checker_; | 75 base::ThreadChecker data_source_thread_checker_; |
75 }; | 76 }; |
76 | 77 |
77 } // namespace metadata | 78 } // namespace metadata |
78 | 79 |
79 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ | 80 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ |
OLD | NEW |