summaryrefslogtreecommitdiffstats
path: root/content/renderer/webplugin_delegate_proxy.cc
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 04:28:17 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 04:28:17 +0000
commit8feb52c0ba8d0136f03321827f9abe2aae1a757d (patch)
tree59158d6c5015ddee36b99b332eaf60679f3569b9 /content/renderer/webplugin_delegate_proxy.cc
parentd8e4f13fbb4eafb7a54c28c9809d6b7c19fd2411 (diff)
downloadchromium_src-8feb52c0ba8d0136f03321827f9abe2aae1a757d.zip
chromium_src-8feb52c0ba8d0136f03321827f9abe2aae1a757d.tar.gz
chromium_src-8feb52c0ba8d0136f03321827f9abe2aae1a757d.tar.bz2
Code to collect issue 97285 debugging info for crash reports.
It is useful to record breakpad keys for debugging, which is not applicable to multi-process bugs. This adds infrastructure to allow collection of information across processes. Also, fix so that GetPluginChannelHost() can successfully fail without crashing. BUG=97285,141055 Review URL: https://chromiumcodereview.appspot.com/10908078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155122 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/webplugin_delegate_proxy.cc')
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index de54a89..b7d93b9 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -59,7 +59,10 @@
#endif
#if defined(OS_MACOSX)
+#include "base/mac/crash_logging.h"
#include "base/mac/mac_util.h"
+#include "base/sys_string_conversions.h"
+#include "content/public/common/content_debug_logging.h"
#endif
#if defined(OS_WIN)
@@ -191,6 +194,22 @@ class ResourceClientProxy : public webkit::npapi::WebPluginResourceClient {
bool multibyte_response_expected_;
};
+#if defined(OS_MACOSX)
+// Helper to load the breakpad information for the given bug, and also
+// log errors.
+void LoadKeysAndLogForBug(int bug_id) {
+ std::vector<std::string> messages;
+
+ CHECK(content::debug::GetMessages(bug_id, &messages));
+ for (size_t i = 0; i < messages.size(); i++) {
+ std::string key(base::StringPrintf("bug-%d-%lu", bug_id, i));
+ base::mac::SetCrashKeyValue(base::SysUTF8ToNSString(key),
+ base::SysUTF8ToNSString(messages[i]));
+ LOG(ERROR) << "messages-" << bug_id << "[" << i << "]: " << messages[i];
+ }
+}
+#endif
+
} // namespace
WebPluginDelegateProxy::WebPluginDelegateProxy(
@@ -325,6 +344,11 @@ bool WebPluginDelegateProxy::Initialize(
&channel_handle, &info_))) {
continue;
}
+#if defined(OS_MACOSX)
+ content::debug::RecordMsg(97285, base::StringPrintf(
+ "OpenChannelToPlugin() {%s, %d}",
+ channel_handle.name.c_str(), channel_handle.socket.fd));
+#endif
if (channel_handle.name.empty()) {
// We got an invalid handle. Either the plugin couldn't be found (which
@@ -346,19 +370,48 @@ bool WebPluginDelegateProxy::Initialize(
PluginChannelHost::GetPluginChannelHost(
channel_handle, ChildProcess::current()->io_message_loop_proxy());
if (!channel_host.get()) {
+#if defined(OS_MACOSX)
+ if (channel_handle.socket.fd == -1) {
+ LOG(ERROR) << "http://crbug.com/97285 detected.";
+ LoadKeysAndLogForBug(97285);
+
+ // Upload the data. This crash used to be in NPChannelBase::Init().
+ // This point can only be MODE_CLIENT.
+ CHECK_NE(channel_handle.socket.fd, -1);
+ }
+#endif
LOG(ERROR) << "Couldn't get PluginChannelHost";
continue;
}
#if defined(OS_MACOSX)
+ content::debug::RecordMsg(141055, base::StringPrintf(
+ "GetPCH() {%s, %d} from {*, %d}, %svalid",
+ channel_host->channel_handle().name.c_str(),
+ channel_host->channel_handle().socket.fd,
+ channel_handle.socket.fd,
+ channel_host->channel_valid() ? "" : "in"));
track_nested_removes.reset();
#endif
{
// TODO(bauerb): Debugging for http://crbug.com/141055.
+#if defined(OS_MACOSX)
ScopedLogLevel log_level(-2); // Equivalent to --v=2
+#endif
result = channel_host->Send(new PluginMsg_CreateInstance(
mime_type_, &instance_id));
if (!result) {
+#if defined(OS_MACOSX)
+ // Don't crash, but load the info into breakpad on the off
+ // chance that the renderer will crash in the future. Even if
+ // it doesn't, the log messages might be reported.
+ // TODO(shess): The renderer may not survive long enough to
+ // crash. Could have the browser load breakpad instead.
+ LOG(ERROR) << "http://crbug.com/141055 possibly detected.";
+ LoadKeysAndLogForBug(141055);
+ LoadKeysAndLogForBug(97285);
+#endif
+
LOG(ERROR) << "Couldn't send PluginMsg_CreateInstance";
continue;
}