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

Side by Side Diff: webkit/plugins/npapi/plugin_list_posix.cc

Issue 8318028: Gracefully handle child process death in out-of-process plugin loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Do not send the index Created 9 years, 2 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 | « webkit/plugins/npapi/plugin_list_mac.mm ('k') | webkit/plugins/npapi/plugin_list_win.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "webkit/plugins/npapi/plugin_list.h" 5 #include "webkit/plugins/npapi/plugin_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // On my Ubuntu system, /usr/lib64 is a symlink to /usr/lib. 157 // On my Ubuntu system, /usr/lib64 is a symlink to /usr/lib.
158 // But a user reported on their Fedora system they are separate. 158 // But a user reported on their Fedora system they are separate.
159 plugin_dirs->push_back(FilePath("/usr/lib64/browser-plugins")); 159 plugin_dirs->push_back(FilePath("/usr/lib64/browser-plugins"));
160 plugin_dirs->push_back(FilePath("/usr/lib64/mozilla/plugins")); 160 plugin_dirs->push_back(FilePath("/usr/lib64/mozilla/plugins"));
161 plugin_dirs->push_back(FilePath("/usr/lib64/firefox/plugins")); 161 plugin_dirs->push_back(FilePath("/usr/lib64/firefox/plugins"));
162 plugin_dirs->push_back(FilePath("/usr/lib64/xulrunner-addons/plugins")); 162 plugin_dirs->push_back(FilePath("/usr/lib64/xulrunner-addons/plugins"));
163 #endif // defined(ARCH_CPU_64_BITS) 163 #endif // defined(ARCH_CPU_64_BITS)
164 #endif // !defined(OS_CHROMEOS) 164 #endif // !defined(OS_CHROMEOS)
165 } 165 }
166 166
167 void PluginList::LoadPluginsFromDir(const FilePath& dir_path, 167 void PluginList::GetPluginsInDir(
168 ScopedVector<PluginGroup>* plugin_groups, 168 const FilePath& dir_path, std::vector<FilePath>* plugins) {
169 std::set<FilePath>* visited_plugins) {
170 // See ScanPluginsDirectory near 169 // See ScanPluginsDirectory near
171 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginHostI mpl.cpp#5052 170 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginHostI mpl.cpp#5052
172 171
173 // Construct and stat a list of all filenames under consideration, for 172 // Construct and stat a list of all filenames under consideration, for
174 // later sorting by mtime. 173 // later sorting by mtime.
175 FileTimeList files; 174 FileTimeList files;
176 file_util::FileEnumerator enumerator(dir_path, 175 file_util::FileEnumerator enumerator(dir_path,
177 false, // not recursive 176 false, // not recursive
178 file_util::FileEnumerator::FILES); 177 file_util::FileEnumerator::FILES);
179 for (FilePath path = enumerator.Next(); !path.value().empty(); 178 for (FilePath path = enumerator.Next(); !path.value().empty();
180 path = enumerator.Next()) { 179 path = enumerator.Next()) {
181 // Skip over Mozilla .xpt files. 180 // Skip over Mozilla .xpt files.
182 if (path.MatchesExtension(FILE_PATH_LITERAL(".xpt"))) 181 if (path.MatchesExtension(FILE_PATH_LITERAL(".xpt")))
183 continue; 182 continue;
184 183
185 // Java doesn't like being loaded through a symlink, since it uses 184 // Java doesn't like being loaded through a symlink, since it uses
186 // its path to find dependent data files. 185 // its path to find dependent data files.
187 // file_util::AbsolutePath calls through to realpath(), which resolves 186 // file_util::AbsolutePath calls through to realpath(), which resolves
188 // symlinks. 187 // symlinks.
189 FilePath orig_path = path; 188 FilePath orig_path = path;
190 file_util::AbsolutePath(&path); 189 file_util::AbsolutePath(&path);
191 LOG_IF(ERROR, PluginList::DebugPluginLoading()) 190 LOG_IF(ERROR, PluginList::DebugPluginLoading())
192 << "Resolved " << orig_path.value() << " -> " << path.value(); 191 << "Resolved " << orig_path.value() << " -> " << path.value();
193 192
194 if (visited_plugins->find(path) != visited_plugins->end()) { 193 if (std::find(plugins->begin(), plugins->end(), path) != plugins->end()) {
195 LOG_IF(ERROR, PluginList::DebugPluginLoading()) 194 LOG_IF(ERROR, PluginList::DebugPluginLoading())
196 << "Skipping duplicate instance of " << path.value(); 195 << "Skipping duplicate instance of " << path.value();
197 continue; 196 continue;
198 } 197 }
199 visited_plugins->insert(path);
200 198
201 if (IsBlacklistedPlugin(path)) { 199 if (IsBlacklistedPlugin(path)) {
202 LOG_IF(ERROR, PluginList::DebugPluginLoading()) 200 LOG_IF(ERROR, PluginList::DebugPluginLoading())
203 << "Skipping blacklisted plugin " << path.value(); 201 << "Skipping blacklisted plugin " << path.value();
204 continue; 202 continue;
205 } 203 }
206 204
207 // Flash stops working if the containing directory involves 'netscape'. 205 // Flash stops working if the containing directory involves 'netscape'.
208 // No joke. So use the other path if it's better. 206 // No joke. So use the other path if it's better.
209 static const char kFlashPlayerFilename[] = "libflashplayer.so"; 207 static const char kFlashPlayerFilename[] = "libflashplayer.so";
(...skipping 17 matching lines...) Expand all
227 continue; 225 continue;
228 226
229 files.push_back(std::make_pair(path, info.last_modified)); 227 files.push_back(std::make_pair(path, info.last_modified));
230 } 228 }
231 229
232 // Sort the file list by time (and filename). 230 // Sort the file list by time (and filename).
233 std::sort(files.begin(), files.end(), CompareTime); 231 std::sort(files.begin(), files.end(), CompareTime);
234 232
235 // Load the files in order. 233 // Load the files in order.
236 for (FileTimeList::const_iterator i = files.begin(); i != files.end(); ++i) { 234 for (FileTimeList::const_iterator i = files.begin(); i != files.end(); ++i) {
237 LoadPlugin(i->first, plugin_groups); 235 plugins->push_back(i->first);
238 } 236 }
239 } 237 }
240 238
241 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, 239 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info,
242 ScopedVector<PluginGroup>* plugin_groups) { 240 ScopedVector<PluginGroup>* plugin_groups) {
243 LOG_IF(ERROR, PluginList::DebugPluginLoading()) 241 LOG_IF(ERROR, PluginList::DebugPluginLoading())
244 << "Considering " << info.path.value() << " (" << info.name << ")"; 242 << "Considering " << info.path.value() << " (" << info.name << ")";
245 243
246 if (IsUndesirablePlugin(info)) { 244 if (IsUndesirablePlugin(info)) {
247 LOG_IF(ERROR, PluginList::DebugPluginLoading()) 245 LOG_IF(ERROR, PluginList::DebugPluginLoading())
(...skipping 19 matching lines...) Expand all
267 265
268 // TODO(evanm): prefer the newest version of flash, etc. here? 266 // TODO(evanm): prefer the newest version of flash, etc. here?
269 267
270 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); 268 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value();
271 269
272 return true; 270 return true;
273 } 271 }
274 272
275 } // namespace npapi 273 } // namespace npapi
276 } // namespace webkit 274 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_list_mac.mm ('k') | webkit/plugins/npapi/plugin_list_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698