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

Side by Side Diff: content/common/pepper_plugin_list.cc

Issue 103623003: Instrument pepper plugin load failures. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years 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
« no previous file with comments | « content/browser/ppapi_plugin_process_host.cc ('k') | content/renderer/render_frame_impl.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 #include "content/common/pepper_plugin_list.h" 5 #include "content/common/pepper_plugin_list.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> ) 49 // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> )
50 // plugin-entry = 50 // plugin-entry =
51 // <file-path> + 51 // <file-path> +
52 // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] + 52 // ["#" + <name> + ["#" + <description> + ["#" + <version>]]] +
53 // *1( LWS + ";" + LWS + <mime-type> ) 53 // *1( LWS + ";" + LWS + <mime-type> )
54 std::vector<std::string> modules; 54 std::vector<std::string> modules;
55 base::SplitString(value, ',', &modules); 55 base::SplitString(value, ',', &modules);
56 56
57 size_t plugins_to_register = modules.size(); 57 size_t plugins_to_register = modules.size();
58 if (plugins_to_register > kMaxPluginsToRegisterFromCommandLine) { 58 if (plugins_to_register > kMaxPluginsToRegisterFromCommandLine) {
59 DLOG(WARNING) << plugins_to_register << " pepper plugins registered from" 59 VLOG(1) << plugins_to_register << " pepper plugins registered from"
60 << " command line which exceeds the limit (maximum " 60 << " command line which exceeds the limit (maximum "
61 << kMaxPluginsToRegisterFromCommandLine << " plugins allowed)"; 61 << kMaxPluginsToRegisterFromCommandLine << " plugins allowed)";
62 plugins_to_register = kMaxPluginsToRegisterFromCommandLine; 62 plugins_to_register = kMaxPluginsToRegisterFromCommandLine;
63 } 63 }
64 64
65 for (size_t i = 0; i < plugins_to_register; ++i) { 65 for (size_t i = 0; i < plugins_to_register; ++i) {
66 std::vector<std::string> parts; 66 std::vector<std::string> parts;
67 base::SplitString(modules[i], ';', &parts); 67 base::SplitString(modules[i], ';', &parts);
68 if (parts.size() < 2) { 68 if (parts.size() < 2) {
69 DLOG(ERROR) << "Required mime-type not found"; 69 VLOG(1) << "Required mime-type not found";
70 continue; 70 continue;
71 } 71 }
72 72
73 std::vector<std::string> name_parts; 73 std::vector<std::string> name_parts;
74 base::SplitString(parts[0], '#', &name_parts); 74 base::SplitString(parts[0], '#', &name_parts);
75 75
76 PepperPluginInfo plugin; 76 PepperPluginInfo plugin;
77 plugin.is_out_of_process = out_of_process; 77 plugin.is_out_of_process = out_of_process;
78 #if defined(OS_WIN) 78 #if defined(OS_WIN)
79 // This means we can't provide plugins from non-ASCII paths, but 79 // This means we can't provide plugins from non-ASCII paths, but
80 // since this switch is only for development I don't think that's 80 // since this switch is only for development I don't think that's
81 // too awful. 81 // too awful.
82 plugin.path = base::FilePath(ASCIIToUTF16(name_parts[0])); 82 plugin.path = base::FilePath(ASCIIToUTF16(name_parts[0]));
83 #else 83 #else
84 plugin.path = base::FilePath(name_parts[0]); 84 plugin.path = base::FilePath(name_parts[0]);
85 #endif 85 #endif
86 86
87 uint64 index_mask = 1ULL << i; 87 uint64 index_mask = 1ULL << i;
88 if (!(skip_file_check_flags & index_mask)) { 88 if (!(skip_file_check_flags & index_mask)) {
89 if (base::PathExists(plugin.path)) { 89 if (base::PathExists(plugin.path)) {
90 skip_file_check_flags |= index_mask; 90 skip_file_check_flags |= index_mask;
91 } else { 91 } else {
92 DLOG(ERROR) << "Plugin doesn't exist:" << plugin.path.MaybeAsASCII(); 92 VLOG(1) << "Plugin doesn't exist: " << plugin.path.MaybeAsASCII();
93 continue; 93 continue;
94 } 94 }
95 } 95 }
96 96
97 if (name_parts.size() > 1) 97 if (name_parts.size() > 1)
98 plugin.name = name_parts[1]; 98 plugin.name = name_parts[1];
99 if (name_parts.size() > 2) 99 if (name_parts.size() > 2)
100 plugin.description = name_parts[2]; 100 plugin.description = name_parts[2];
101 if (name_parts.size() > 3) 101 if (name_parts.size() > 3)
102 plugin.version = name_parts[3]; 102 plugin.version = name_parts[3];
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 return true; 141 return true;
142 } 142 }
143 143
144 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) { 144 void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) {
145 GetContentClient()->AddPepperPlugins(plugins); 145 GetContentClient()->AddPepperPlugins(plugins);
146 ComputePluginsFromCommandLine(plugins); 146 ComputePluginsFromCommandLine(plugins);
147 } 147 }
148 148
149 } // namespace content 149 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698