OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROME_CONTENT_UTILITY_CLIENT_H_ | 5 #ifndef CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
6 #define CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ | 6 #define CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... | |
35 // Shared with extensions::ExtensionsHandler. | 35 // Shared with extensions::ExtensionsHandler. |
36 static SkBitmap DecodeImage(const std::vector<unsigned char>& encoded_data, | 36 static SkBitmap DecodeImage(const std::vector<unsigned char>& encoded_data, |
37 bool shrink_to_fit); | 37 bool shrink_to_fit); |
38 static void DecodeImageAndSend(const std::vector<unsigned char>& encoded_data, | 38 static void DecodeImageAndSend(const std::vector<unsigned char>& encoded_data, |
39 bool shrink_to_fit); | 39 bool shrink_to_fit); |
40 | 40 |
41 static void set_max_ipc_message_size_for_test(int64_t max_message_size) { | 41 static void set_max_ipc_message_size_for_test(int64_t max_message_size) { |
42 max_ipc_message_size_ = max_message_size; | 42 max_ipc_message_size_ = max_message_size; |
43 } | 43 } |
44 | 44 |
45 // Reference counting for Mojo services. A reference count is incremented when | |
46 // Mojo services are connected to, and decremented when the connection is | |
47 // destroyed. When the count reaches 0, this process is freed. The assumption | |
48 // is that multiple Mojo services can be connected to in the same utility | |
49 // process. This is a Mojo alternative to "batch mode" for Chrome IPC. | |
50 void MojoRef(); | |
sky
2015/04/01 15:00:45
Who is responsible for invoking these?
Anand Mistry (off Chromium)
2015/04/02 04:29:45
Added a blurb to describe this. At this point, I'm
sky
2015/04/02 17:20:10
Having to explicitly invoke functions like this is
Anand Mistry (off Chromium)
2015/04/08 07:14:15
On further thought, there are races with this kind
| |
51 void MojoUnref(); | |
52 | |
45 private: | 53 private: |
46 // IPC message handlers. | 54 // IPC message handlers. |
47 void OnUnpackWebResource(const std::string& resource_data); | 55 void OnUnpackWebResource(const std::string& resource_data); |
48 void OnDecodeImage(const std::vector<unsigned char>& encoded_data, | 56 void OnDecodeImage(const std::vector<unsigned char>& encoded_data, |
49 bool shrink_to_fit); | 57 bool shrink_to_fit); |
50 void OnRobustJPEGDecodeImage( | 58 void OnRobustJPEGDecodeImage( |
51 const std::vector<unsigned char>& encoded_data); | 59 const std::vector<unsigned char>& encoded_data); |
52 | 60 |
53 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
54 void OnCreateZipFile(const base::FilePath& src_dir, | 62 void OnCreateZipFile(const base::FilePath& src_dir, |
(...skipping 27 matching lines...) Expand all Loading... | |
82 typedef ScopedVector<UtilityMessageHandler> Handlers; | 90 typedef ScopedVector<UtilityMessageHandler> Handlers; |
83 Handlers handlers_; | 91 Handlers handlers_; |
84 | 92 |
85 // Flag to enable whitelisting. | 93 // Flag to enable whitelisting. |
86 bool filter_messages_; | 94 bool filter_messages_; |
87 // A list of message_ids to filter. | 95 // A list of message_ids to filter. |
88 std::set<int> message_id_whitelist_; | 96 std::set<int> message_id_whitelist_; |
89 // Maximum IPC msg size (default to kMaximumMessageSize; override for testing) | 97 // Maximum IPC msg size (default to kMaximumMessageSize; override for testing) |
90 static int64_t max_ipc_message_size_; | 98 static int64_t max_ipc_message_size_; |
91 | 99 |
100 int32_t mojo_service_ref_count_; | |
101 | |
92 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); | 102 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); |
93 }; | 103 }; |
94 | 104 |
95 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ | 105 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
OLD | NEW |