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

Side by Side Diff: chrome/utility/media_galleries/ipc_data_source.h

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 unified diff | Download patch
OLDNEW
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>
9
8 #include <map> 10 #include <map>
9 #include <string> 11 #include <string>
10 12
11 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
12 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
13 #include "chrome/utility/utility_message_handler.h" 15 #include "chrome/utility/utility_message_handler.h"
14 #include "media/base/data_source.h" 16 #include "media/base/data_source.h"
15 17
16 namespace base { 18 namespace base {
17 class TaskRunner; 19 class TaskRunner;
18 } 20 }
19 21
20 namespace metadata { 22 namespace metadata {
21 23
22 // Provides the metadata parser with bytes from the browser process via IPC. 24 // Provides the metadata parser with bytes from the browser process via IPC.
23 // Class must be created and destroyed on the utility thread. Class may be used 25 // Class must be created and destroyed on the utility thread. Class may be used
24 // as a DataSource on a different thread. The utility thread must not be blocked 26 // as a DataSource on a different thread. The utility thread must not be blocked
25 // for read operations to succeed. 27 // for read operations to succeed.
26 class IPCDataSource: public media::DataSource, 28 class IPCDataSource: public media::DataSource,
27 public UtilityMessageHandler { 29 public UtilityMessageHandler {
28 public: 30 public:
29 // May only be called on the utility thread. 31 // May only be called on the utility thread.
30 explicit IPCDataSource(int64 total_size); 32 explicit IPCDataSource(int64_t total_size);
31 ~IPCDataSource() override; 33 ~IPCDataSource() override;
32 34
33 // Implementation of DataSource. These methods may be called on any single 35 // Implementation of DataSource. These methods may be called on any single
34 // thread. First usage of these methods attaches a thread checker. 36 // thread. First usage of these methods attaches a thread checker.
35 void Stop() override; 37 void Stop() override;
36 void Read(int64 position, 38 void Read(int64_t position,
37 int size, 39 int size,
38 uint8* data, 40 uint8_t* data,
39 const ReadCB& read_cb) override; 41 const ReadCB& read_cb) override;
40 bool GetSize(int64* size_out) override; 42 bool GetSize(int64_t* size_out) override;
41 bool IsStreaming() override; 43 bool IsStreaming() override;
42 void SetBitrate(int bitrate) override; 44 void SetBitrate(int bitrate) override;
43 45
44 // Implementation of UtilityMessageHandler. May only be called on the utility 46 // Implementation of UtilityMessageHandler. May only be called on the utility
45 // thread. 47 // thread.
46 bool OnMessageReceived(const IPC::Message& message) override; 48 bool OnMessageReceived(const IPC::Message& message) override;
47 49
48 private: 50 private:
49 struct Request { 51 struct Request {
50 Request(); 52 Request();
51 ~Request(); 53 ~Request();
52 uint8* destination; 54 uint8_t* destination;
53 ReadCB callback; 55 ReadCB callback;
54 }; 56 };
55 57
56 void ReadOnUtilityThread(int64 position, int size, uint8* data, 58 void ReadOnUtilityThread(int64_t position,
59 int size,
60 uint8_t* data,
57 const ReadCB& read_cb); 61 const ReadCB& read_cb);
58 62
59 void OnRequestBlobBytesFinished(int64 request_id, 63 void OnRequestBlobBytesFinished(int64_t request_id, const std::string& bytes);
60 const std::string& bytes);
61 64
62 const int64 total_size_; 65 const int64_t total_size_;
63 66
64 scoped_refptr<base::TaskRunner> utility_task_runner_; 67 scoped_refptr<base::TaskRunner> utility_task_runner_;
65 std::map<int64, Request> pending_requests_; 68 std::map<int64_t, Request> pending_requests_;
66 int64 next_request_id_; 69 int64_t next_request_id_;
67 70
68 base::ThreadChecker utility_thread_checker_; 71 base::ThreadChecker utility_thread_checker_;
69 72
70 // Enforces that the DataSource methods are called on one other thread only. 73 // Enforces that the DataSource methods are called on one other thread only.
71 base::ThreadChecker data_source_thread_checker_; 74 base::ThreadChecker data_source_thread_checker_;
72 }; 75 };
73 76
74 } // namespace metadata 77 } // namespace metadata
75 78
76 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ 79 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « chrome/utility/media_galleries/image_metadata_extractor.cc ('k') | chrome/utility/media_galleries/ipc_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698