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

Unified Diff: content/renderer/webplugin_delegate_proxy.cc

Issue 10908078: Code to collect issue 97285 debugging info for crash reports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase against r155094. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/webplugin_delegate_proxy.cc
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index de54a894ac4f9b37d7529b9845ec4177cecea029..b7d93b9bef280959555441f39a81e590759ef8ab 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;
}
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698