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

Side by Side Diff: content/browser/plugin_loader_posix.h

Issue 128773002: Restart plugin loading only if the plugin list has actually become stale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/plugins/plugin_prefs_unittest.cc ('k') | content/browser/plugin_loader_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
9 #include <vector> 8 #include <vector>
10 9
11 #include "base/basictypes.h" 10 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
14 #include "base/time/time.h" 13 #include "base/time/time.h"
15 #include "content/browser/plugin_service_impl.h" 14 #include "content/browser/plugin_service_impl.h"
16 #include "content/public/browser/utility_process_host_client.h" 15 #include "content/public/browser/utility_process_host_client.h"
17 #include "content/public/common/webplugininfo.h" 16 #include "content/public/common/webplugininfo.h"
18 #include "ipc/ipc_sender.h" 17 #include "ipc/ipc_sender.h"
(...skipping 25 matching lines...) Expand all
44 // load, bypassing the problematic plugin. 43 // load, bypassing the problematic plugin.
45 // 5. This algorithm continues until the canonical list has been walked to the 44 // 5. This algorithm continues until the canonical list has been walked to the
46 // end, after which the list of loaded plugins is set on the PluginList and 45 // end, after which the list of loaded plugins is set on the PluginList and
47 // the completion callback is run. 46 // the completion callback is run.
48 class CONTENT_EXPORT PluginLoaderPosix 47 class CONTENT_EXPORT PluginLoaderPosix
49 : public NON_EXPORTED_BASE(UtilityProcessHostClient), 48 : public NON_EXPORTED_BASE(UtilityProcessHostClient),
50 public IPC::Sender { 49 public IPC::Sender {
51 public: 50 public:
52 PluginLoaderPosix(); 51 PluginLoaderPosix();
53 52
54 // Must be called from the IO thread. 53 // Must be called from the IO thread. The |callback| will be called on the IO
55 void LoadPlugins( 54 // thread too.
56 scoped_refptr<base::MessageLoopProxy> target_loop, 55 void GetPlugins(const PluginService::GetPluginsCallback& callback);
57 const PluginService::GetPluginsCallback& callback);
58 56
59 // UtilityProcessHostClient: 57 // UtilityProcessHostClient:
60 virtual void OnProcessCrashed(int exit_code) OVERRIDE; 58 virtual void OnProcessCrashed(int exit_code) OVERRIDE;
61 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
62 60
63 // IPC::Sender: 61 // IPC::Sender:
64 virtual bool Send(IPC::Message* msg) OVERRIDE; 62 virtual bool Send(IPC::Message* msg) OVERRIDE;
65 63
66 private: 64 private:
67 struct PendingCallback {
68 PendingCallback(scoped_refptr<base::MessageLoopProxy> target_loop,
69 const PluginService::GetPluginsCallback& callback);
70 ~PendingCallback();
71
72 scoped_refptr<base::MessageLoopProxy> target_loop;
73 PluginService::GetPluginsCallback callback;
74 };
75
76 virtual ~PluginLoaderPosix(); 65 virtual ~PluginLoaderPosix();
77 66
78 // Called on the FILE thread to get the list of plugin paths to probe. 67 // Called on the FILE thread to get the list of plugin paths to probe.
79 void GetPluginsToLoad(); 68 void GetPluginsToLoad();
80 69
81 // Must be called on the IO thread. 70 // Must be called on the IO thread.
82 virtual void LoadPluginsInternal(); 71 virtual void LoadPluginsInternal();
83 72
73 // Called after plugin loading has finished, if we don't know whether the
74 // plugin list has been invalidated in the mean time.
75 void GetPluginsWrapper(
76 const PluginService::GetPluginsCallback& callback,
77 const std::vector<WebPluginInfo>& plugins_unused);
78
84 // Message handlers. 79 // Message handlers.
85 void OnPluginLoaded(uint32 index, const WebPluginInfo& plugin); 80 void OnPluginLoaded(uint32 index, const WebPluginInfo& plugin);
86 void OnPluginLoadFailed(uint32 index, const base::FilePath& plugin_path); 81 void OnPluginLoadFailed(uint32 index, const base::FilePath& plugin_path);
87 82
88 // Checks if the plugin path is an internal plugin, and, if it is, adds it to 83 // Checks if the plugin path is an internal plugin, and, if it is, adds it to
89 // |loaded_plugins_|. 84 // |loaded_plugins_|.
90 bool MaybeAddInternalPlugin(const base::FilePath& plugin_path); 85 bool MaybeAddInternalPlugin(const base::FilePath& plugin_path);
91 86
92 // Runs all the registered callbacks on each's target loop if the condition 87 // Runs all the registered callbacks on each's target loop if the condition
93 // for ending the load process is done (i.e. the |next_load_index_| is outside 88 // for ending the load process is done (i.e. the |next_load_index_| is outside
(...skipping 12 matching lines...) Expand all
106 size_t next_load_index_; 101 size_t next_load_index_;
107 102
108 // Internal plugins that have been registered at the time of loading. 103 // Internal plugins that have been registered at the time of loading.
109 std::vector<WebPluginInfo> internal_plugins_; 104 std::vector<WebPluginInfo> internal_plugins_;
110 105
111 // A vector of plugins that have been loaded successfully. 106 // A vector of plugins that have been loaded successfully.
112 std::vector<WebPluginInfo> loaded_plugins_; 107 std::vector<WebPluginInfo> loaded_plugins_;
113 108
114 // The callback and message loop on which the callback will be run when the 109 // The callback and message loop on which the callback will be run when the
115 // plugin loading process has been completed. 110 // plugin loading process has been completed.
116 std::deque<PendingCallback> callbacks_; 111 std::vector<PluginService::GetPluginsCallback> callbacks_;
117 112
118 // The time at which plugin loading started. 113 // The time at which plugin loading started.
119 base::TimeTicks load_start_time_; 114 base::TimeTicks load_start_time_;
120 115
121 friend class MockPluginLoaderPosix; 116 friend class MockPluginLoaderPosix;
122 DISALLOW_COPY_AND_ASSIGN(PluginLoaderPosix); 117 DISALLOW_COPY_AND_ASSIGN(PluginLoaderPosix);
123 }; 118 };
124 119
125 } // namespace content 120 } // namespace content
126 121
127 #endif // CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ 122 #endif // CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_prefs_unittest.cc ('k') | content/browser/plugin_loader_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698