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 CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ | 5 #ifndef CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ |
6 #define CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ | 6 #define CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "content/browser/plugin_service_impl.h" | 15 #include "content/browser/plugin_service_impl.h" |
16 #include "content/public/browser/utility_process_host_client.h" | 16 #include "content/public/browser/utility_process_host_client.h" |
17 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_sender.h" |
18 #include "webkit/plugins/webplugininfo.h" | 18 #include "webkit/plugins/webplugininfo.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class MessageLoopProxy; | 21 class MessageLoopProxy; |
22 } | 22 } |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 class UtilityProcessHost; | 25 class UtilityProcessHost; |
26 } | 26 } |
27 | 27 |
(...skipping 13 matching lines...) Expand all Loading... |
41 // processes synchronize the position in the vector that will be used to | 41 // processes synchronize the position in the vector that will be used to |
42 // attempt to load the next plugin. | 42 // attempt to load the next plugin. |
43 // 4. If the child dies during this process, the host forks another child and | 43 // 4. If the child dies during this process, the host forks another child and |
44 // resumes loading at the position past the plugin that it just attempted to | 44 // resumes loading at the position past the plugin that it just attempted to |
45 // load, bypassing the problematic plugin. | 45 // load, bypassing the problematic plugin. |
46 // 5. This algorithm continues until the canonical list has been walked to the | 46 // 5. This algorithm continues until the canonical list has been walked to the |
47 // end, after which the list of loaded plugins is set on the PluginList and | 47 // end, after which the list of loaded plugins is set on the PluginList and |
48 // the completion callback is run. | 48 // the completion callback is run. |
49 class CONTENT_EXPORT PluginLoaderPosix | 49 class CONTENT_EXPORT PluginLoaderPosix |
50 : public NON_EXPORTED_BASE(content::UtilityProcessHostClient), | 50 : public NON_EXPORTED_BASE(content::UtilityProcessHostClient), |
51 public IPC::Message::Sender { | 51 public IPC::Sender { |
52 public: | 52 public: |
53 PluginLoaderPosix(); | 53 PluginLoaderPosix(); |
54 | 54 |
55 // Must be called from the IO thread. | 55 // Must be called from the IO thread. |
56 void LoadPlugins( | 56 void LoadPlugins( |
57 scoped_refptr<base::MessageLoopProxy> target_loop, | 57 scoped_refptr<base::MessageLoopProxy> target_loop, |
58 const content::PluginService::GetPluginsCallback& callback); | 58 const content::PluginService::GetPluginsCallback& callback); |
59 | 59 |
60 // UtilityProcessHostClient: | 60 // UtilityProcessHostClient: |
61 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 61 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
63 | 63 |
64 // IPC::Message::Sender: | 64 // IPC::Sender: |
65 virtual bool Send(IPC::Message* msg) OVERRIDE; | 65 virtual bool Send(IPC::Message* msg) OVERRIDE; |
66 | 66 |
67 private: | 67 private: |
68 struct PendingCallback { | 68 struct PendingCallback { |
69 PendingCallback(scoped_refptr<base::MessageLoopProxy> target_loop, | 69 PendingCallback(scoped_refptr<base::MessageLoopProxy> target_loop, |
70 const content::PluginService::GetPluginsCallback& callback); | 70 const content::PluginService::GetPluginsCallback& callback); |
71 ~PendingCallback(); | 71 ~PendingCallback(); |
72 | 72 |
73 scoped_refptr<base::MessageLoopProxy> target_loop; | 73 scoped_refptr<base::MessageLoopProxy> target_loop; |
74 content::PluginService::GetPluginsCallback callback; | 74 content::PluginService::GetPluginsCallback callback; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 std::deque<PendingCallback> callbacks_; | 117 std::deque<PendingCallback> callbacks_; |
118 | 118 |
119 // The time at which plugin loading started. | 119 // The time at which plugin loading started. |
120 base::TimeTicks load_start_time_; | 120 base::TimeTicks load_start_time_; |
121 | 121 |
122 friend class MockPluginLoaderPosix; | 122 friend class MockPluginLoaderPosix; |
123 DISALLOW_COPY_AND_ASSIGN(PluginLoaderPosix); | 123 DISALLOW_COPY_AND_ASSIGN(PluginLoaderPosix); |
124 }; | 124 }; |
125 | 125 |
126 #endif // CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ | 126 #endif // CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ |
OLD | NEW |