summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/plugin_process_host.cc16
-rw-r--r--content/browser/plugin_process_host.h5
-rw-r--r--content/browser/renderer_host/render_message_filter.cc20
-rw-r--r--content/browser/renderer_host/render_message_filter.h5
-rw-r--r--content/common/content_debug_logging.cc45
-rw-r--r--content/common/content_debug_logging_unittest.cc114
-rw-r--r--content/common/plugin_messages.h8
-rw-r--r--content/common/view_messages.h9
-rw-r--r--content/content_common.gypi2
-rw-r--r--content/content_tests.gypi5
-rw-r--r--content/plugin/plugin_thread.cc21
-rw-r--r--content/public/common/content_debug_logging.h62
-rw-r--r--content/renderer/render_thread_impl.cc15
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc53
14 files changed, 378 insertions, 2 deletions
diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc
index 23cac73..b0d0f2c 100644
--- a/content/browser/plugin_process_host.cc
+++ b/content/browser/plugin_process_host.cc
@@ -32,6 +32,7 @@
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/plugin_service.h"
+#include "content/public/common/content_debug_logging.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/process_type.h"
#include "ipc/ipc_switches.h"
@@ -333,6 +334,10 @@ bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSetCursorVisibility,
OnPluginSetCursorVisibility)
#endif
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ContentDebugRecordMsg,
+ OnContentDebugRecordMsg)
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ContentDebugGetMessages,
+ OnContentDebugGetMessages)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -454,3 +459,14 @@ void PluginProcessHost::OnChannelCreated(
client->OnChannelOpened(channel_handle);
sent_requests_.pop_front();
}
+
+// TODO(shess): Could this be annotated WRT the sending plugin?
+void PluginProcessHost::OnContentDebugRecordMsg(int bug_id,
+ const std::string& msg) {
+ content::debug::RecordMsg(bug_id, msg);
+}
+
+void PluginProcessHost::OnContentDebugGetMessages(
+ int bug_id, bool* handled, std::vector<std::string>* msgs) {
+ *handled = content::debug::GetMessages(bug_id, msgs);
+}
diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h
index fc00434..95b2536 100644
--- a/content/browser/plugin_process_host.h
+++ b/content/browser/plugin_process_host.h
@@ -148,6 +148,11 @@ class CONTENT_EXPORT PluginProcessHost
void OnPluginSetCursorVisibility(bool visible);
#endif
+ // Forward client messages to content::debug::RecordMsg/GetMessages.
+ void OnContentDebugRecordMsg(int bug_id, const std::string& msg);
+ void OnContentDebugGetMessages(int bug_id, bool* handled,
+ std::vector<std::string>* msgs);
+
virtual bool CanShutdown() OVERRIDE;
virtual void OnProcessCrashed(int exit_code) OVERRIDE;
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index aa971df..628a84e 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -39,6 +39,7 @@
#include "content/public/browser/plugin_service_filter.h"
#include "content/public/browser/resource_context.h"
#include "content/public/browser/user_metrics.h"
+#include "content/public/common/content_debug_logging.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/context_menu_params.h"
#include "content/public/common/url_constants.h"
@@ -237,6 +238,10 @@ class RenderMessageFilter::OpenChannelToNpapiPluginCallback
}
virtual void OnChannelOpened(const IPC::ChannelHandle& handle) OVERRIDE {
+#if defined(OS_MACOSX)
+ content::debug::RecordMsg(97285, base::StringPrintf(
+ "OnChannelOpened({%s, %d})", handle.name.c_str(), handle.socket.fd));
+#endif
WriteReplyAndDeleteThis(handle);
}
@@ -392,6 +397,10 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(ViewHostMsg_GetMonitorColorProfile,
OnGetMonitorColorProfile)
IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvent, OnMediaLogEvent)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ContentDebugRecordMsg,
+ OnContentDebugRecordMsg)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ContentDebugGetMessages,
+ OnContentDebugGetMessages)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
@@ -979,4 +988,15 @@ void RenderMessageFilter::OnUpdateIsDelayed(const IPC::Message& msg) {
render_widget_helper_->DidReceiveBackingStoreMsg(msg);
}
+// TODO(shess): Could this be annotated WRT the sending renderer?
+void RenderMessageFilter::OnContentDebugRecordMsg(int bug_id,
+ const std::string& msg) {
+ content::debug::RecordMsg(bug_id, msg);
+}
+
+void RenderMessageFilter::OnContentDebugGetMessages(
+ int bug_id, bool* handled, std::vector<std::string>* msgs) {
+ *handled = content::debug::GetMessages(bug_id, msgs);
+}
+
} // namespace content
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index 0ab0135..5db6939 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -240,6 +240,11 @@ class RenderMessageFilter : public BrowserMessageFilter {
void OnUpdateIsDelayed(const IPC::Message& msg);
+ // Forward client messages to content::debug::RecordMsg/GetMessages.
+ void OnContentDebugRecordMsg(int bug_id, const std::string& msg);
+ void OnContentDebugGetMessages(int bug_id, bool* handled,
+ std::vector<std::string>* msgs);
+
// Cached resource request dispatcher host and plugin service, guaranteed to
// be non-null if Init succeeds. We do not own the objects, they are managed
// by the BrowserProcess, which has a wider scope than we do.
diff --git a/content/common/content_debug_logging.cc b/content/common/content_debug_logging.cc
new file mode 100644
index 0000000..af8bf18
--- /dev/null
+++ b/content/common/content_debug_logging.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/common/content_debug_logging.h"
+
+#include "base/logging.h"
+
+namespace content {
+namespace debug {
+
+namespace {
+
+// These should be initialized by the process as early in main() as
+// possible, so should be thread-safe.
+RecordMsgFn* g_record_handler = NULL;
+GetMessagesFn* g_get_handler = NULL;
+
+} // namespace
+
+void RegisterMessageHandlers(RecordMsgFn* record_handler,
+ GetMessagesFn* get_handler) {
+ g_record_handler = record_handler;
+ g_get_handler = get_handler;
+}
+
+void RecordMsg(int bug_id, const std::string& msg) {
+ // TODO(shess): It might be useful to log warnings or even DCHECK if
+ // there is no handler, since that implies that the messages are not
+ // being recorded. Unfortunately, it would also cause dirty test
+ // output.
+ if (g_record_handler)
+ (*g_record_handler)(bug_id, msg);
+}
+
+bool GetMessages(int bug_id, std::vector<std::string>* msgs) {
+ if (g_get_handler)
+ return (*g_get_handler)(bug_id, msgs);
+
+ msgs->clear();
+ return false;
+}
+
+} // namespace debug
+} // namespace content
diff --git a/content/common/content_debug_logging_unittest.cc b/content/common/content_debug_logging_unittest.cc
new file mode 100644
index 0000000..5217ce1
--- /dev/null
+++ b/content/common/content_debug_logging_unittest.cc
@@ -0,0 +1,114 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/common/content_debug_logging.h"
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+// Makes sure that the handlers are cleared during teardown.
+class ContentDebugLoggingTest : public testing::Test {
+ public:
+ ContentDebugLoggingTest() {}
+ virtual ~ContentDebugLoggingTest() {}
+
+ void SetUp() {
+ messages = &messages_storage;
+ content::debug::RegisterMessageHandlers(
+ ContentDebugLoggingTest::RecordMsg,
+ ContentDebugLoggingTest::GetMessages);
+ }
+
+ void TearDown() {
+ // Clean up side effects.
+ content::debug::RegisterMessageHandlers(NULL, NULL);
+ messages = NULL;
+ }
+
+ static void RecordMsg(int bug_id, const std::string& msg) {
+ if (messages)
+ (*messages)[bug_id].push_back(msg);
+ }
+
+ static bool GetMessages(int bug_id, std::vector<std::string>* msgs) {
+ if (!messages) {
+ msgs->clear();
+ return false;
+ }
+
+ *msgs = (*messages)[bug_id];
+ return true;
+ }
+
+ // bug_id -> messages for that id.
+ typedef std::map<int, std::vector<std::string> > MessageMap;
+ MessageMap messages_storage;
+
+ // Points to messages_storage while running tests.
+ static MessageMap* messages;
+};
+
+// static
+ContentDebugLoggingTest::MessageMap* ContentDebugLoggingTest::messages = NULL;
+
+TEST_F(ContentDebugLoggingTest, NullLogging) {
+ content::debug::RegisterMessageHandlers(NULL, NULL);
+
+ const std::string kMessage("This is a test");
+ const int kBug = 1;
+ content::debug::RecordMsg(kBug, kMessage);
+
+ // Cannot get the message back.
+ std::vector<std::string> bug_messages;
+ EXPECT_FALSE(content::debug::GetMessages(kBug, &bug_messages));
+ EXPECT_EQ(bug_messages.size(), 0u);
+}
+
+TEST_F(ContentDebugLoggingTest, BasicLogging) {
+ const std::string kMessage1("This is a test");
+ const std::string kMessage2("That was a test");
+ const int kBug = 1;
+
+ // Distinguish ability to retrieve messages from presence of
+ // messages.
+ std::vector<std::string> bug_messages;
+ EXPECT_TRUE(content::debug::GetMessages(kBug, &bug_messages));
+ EXPECT_EQ(bug_messages.size(), 0u);
+
+ // Message is stored and can be retrieved.
+ content::debug::RecordMsg(kBug, kMessage1);
+ EXPECT_TRUE(content::debug::GetMessages(kBug, &bug_messages));
+ ASSERT_EQ(bug_messages.size(), 1u);
+ EXPECT_EQ(bug_messages[0], kMessage1);
+
+ // Messages are returned in recorded order.
+ content::debug::RecordMsg(kBug, kMessage2);
+ EXPECT_TRUE(content::debug::GetMessages(kBug, &bug_messages));
+ ASSERT_EQ(bug_messages.size(), 2u);
+ EXPECT_EQ(bug_messages[0], kMessage1);
+ EXPECT_EQ(bug_messages[1], kMessage2);
+}
+
+TEST_F(ContentDebugLoggingTest, SeparateBugs) {
+ const std::string kMessage("This is a test");
+ const int kBug = 1;
+ content::debug::RecordMsg(kBug, kMessage);
+ content::debug::RecordMsg(17, std::string("Some other message"));
+
+ // Only get the message for this bug back.
+ std::vector<std::string> bug_messages;
+ EXPECT_TRUE(content::debug::GetMessages(kBug, &bug_messages));
+ ASSERT_EQ(bug_messages.size(), 1u);
+ EXPECT_EQ(bug_messages[0], kMessage);
+
+ // There are messages for multiple bugs, though.
+ EXPECT_EQ(messages->size(), 2u);
+}
+
+} // namespace
diff --git a/content/common/plugin_messages.h b/content/common/plugin_messages.h
index a096021..2bc0afd 100644
--- a/content/common/plugin_messages.h
+++ b/content/common/plugin_messages.h
@@ -472,6 +472,14 @@ IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse,
bool /* allow */,
int /* resource_id */)
+// Forward client content_debug_logging to the host process's implementation.
+IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_ContentDebugRecordMsg,
+ int /* bug_id */,
+ std::string /* msg */)
+IPC_SYNC_MESSAGE_CONTROL1_2(PluginProcessHostMsg_ContentDebugGetMessages,
+ int /* bug_id */,
+ bool /* handled */,
+ std::vector<std::string> /* msgs */)
//-----------------------------------------------------------------------------
// NPObject messages
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 49ab7ba2..ea7485a 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -2347,3 +2347,12 @@ IPC_MESSAGE_ROUTED3(ViewHostMsg_FindMatchRects_Reply,
std::vector<gfx::RectF> /* rects */,
gfx::RectF /* active_rect */)
#endif
+
+// Forward client content_debug_logging to the host process's implementation.
+IPC_MESSAGE_CONTROL2(ViewHostMsg_ContentDebugRecordMsg,
+ int /* bug_id */,
+ std::string /* msg */)
+IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ContentDebugGetMessages,
+ int /* bug_id */,
+ bool /* handled */,
+ std::vector<std::string> /* msgs */)
diff --git a/content/content_common.gypi b/content/content_common.gypi
index c994b55..937c663 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -40,6 +40,7 @@
'public/common/compositor_util.h',
'public/common/content_constants.cc',
'public/common/content_constants.h',
+ 'public/common/content_debug_logging.h',
'public/common/content_descriptors.h',
'public/common/content_paths.h',
'public/common/content_restriction.h',
@@ -151,6 +152,7 @@
'common/compositor_util.cc',
'common/content_constants_internal.cc',
'common/content_constants_internal.h',
+ 'common/content_debug_logging.cc',
'common/content_export.h',
'common/content_message_generator.cc',
'common/content_message_generator.h',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index fcdd5d4..fcb9051 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -318,13 +318,14 @@
'browser/web_contents/web_drag_source_mac_unittest.mm',
'browser/webui/web_ui_message_handler_unittest.cc',
'common/android/address_parser_unittest.cc',
- 'common/mac/attributed_string_coder_unittest.mm',
- 'common/mac/font_descriptor_unittest.mm',
+ 'common/content_debug_logging_unittest.cc',
'common/gpu/gpu_info_unittest.cc',
'common/gpu/gpu_memory_manager_unittest.cc',
'common/gpu/media/avc_config_record_builder_unittest.cc',
'common/indexed_db/indexed_db_dispatcher_unittest.cc',
'common/inter_process_time_ticks_converter_unittest.cc',
+ 'common/mac/attributed_string_coder_unittest.mm',
+ 'common/mac/font_descriptor_unittest.mm',
'common/page_zoom_unittest.cc',
'common/resource_dispatcher_unittest.cc',
'common/sandbox_mac_diraccess_unittest.mm',
diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc
index 75a692e..3f90eb7 100644
--- a/content/plugin/plugin_thread.cc
+++ b/content/plugin/plugin_thread.cc
@@ -23,6 +23,7 @@
#include "content/common/child_process.h"
#include "content/common/npobject_util.h"
#include "content/common/plugin_messages.h"
+#include "content/public/common/content_debug_logging.h"
#include "content/public/common/content_switches.h"
#include "content/public/plugin/content_plugin_client.h"
#include "ipc/ipc_channel_handle.h"
@@ -68,6 +69,19 @@ class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter {
}
};
+void RecordMsg(int bug_id, const std::string& msg) {
+ PluginThread::current()->Send(
+ new PluginProcessHostMsg_ContentDebugRecordMsg(bug_id, msg));
+}
+
+bool GetMessages(int bug_id, std::vector<std::string>* msgs) {
+ bool handled = false;
+ PluginThread::current()->Send(
+ new PluginProcessHostMsg_ContentDebugGetMessages(
+ bug_id, &handled, msgs));
+ return handled;
+}
+
} // namespace
static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls =
@@ -107,6 +121,8 @@ PluginThread::PluginThread()
ui::SetDefaultX11ErrorHandlers();
#endif
+ content::debug::RegisterMessageHandlers(RecordMsg, GetMessages);
+
PatchNPNFunctions();
// Preload the library to avoid loading, unloading then reloading
@@ -177,6 +193,11 @@ void PluginThread::OnCreateChannel(int renderer_id,
channel->set_incognito(incognito);
}
+#if defined(OS_MACOSX)
+ content::debug::RecordMsg(97285, base::StringPrintf(
+ "OnCreateChannel({%s, %d})",
+ channel_handle.name.c_str(), channel_handle.socket.fd));
+#endif
Send(new PluginProcessHostMsg_ChannelCreated(channel_handle));
}
diff --git a/content/public/common/content_debug_logging.h b/content/public/common/content_debug_logging.h
new file mode 100644
index 0000000..1d66389
--- /dev/null
+++ b/content/public/common/content_debug_logging.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_
+#define CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_
+
+#include "content/common/content_export.h"
+
+#include <string>
+#include <vector>
+
+// When debugging single processes, a common technique is to store
+// breakpad keys which can be analyzed from crashes. That technique
+// does not work well for multi-process bugs. This code can
+// be used to implement a ring buffer in the browser which stores the
+// most-recent N (browser-defined) messages relating to a bug.
+//
+// The intent is that users will call RecordMsg() to record info for
+// the bug, and GetMessages() to fetch the recorded info. In the
+// browser process, these will be backed by a local data structure.
+// In other processes, they will be backed by messages forwarding to
+// the browser process.
+
+// TODO(shess): Since bug notes will be distributed across the code,
+// it would be inconvenient to require some other include to have
+// kBugNNNNN constants for users to use. Those could be in this file,
+// but for now they're a DCHECK in chrome_delegate_main.cc (which
+// implements the actual storage).
+
+namespace content {
+namespace debug {
+
+// RecordMsg() and GetMessages() forward to the handlers set by
+// RegisterMessageHandlers(). If no handlers are set (or NULL
+// handlers are set), the messages are simply dropped.
+//
+// If GetMessages() returns false, there was no handler (or the
+// handler was unable to get messages). *msgs will be cleared. If
+// GetMessages() returns true, zero or more of the most recent
+// messages previously sent to RecordMsg() will be in *msgs, in the
+// order recorded, mod things like forwarded delay between processes.
+CONTENT_EXPORT void RecordMsg(int bug_id, const std::string& msg);
+CONTENT_EXPORT bool GetMessages(int bug_id, std::vector<std::string>* msgs);
+
+// Used to register handlers which will differ per process.
+typedef void RecordMsgFn(int bug_id, const std::string& msg);
+typedef bool GetMessagesFn(int bug_id, std::vector<std::string>* msgs);
+CONTENT_EXPORT void RegisterMessageHandlers(RecordMsgFn* record_handler,
+ GetMessagesFn* get_handler);
+
+// TODO(shess): It would be convenient to expose functions to do things like:
+// - load values into breakpad.
+// - load values into breakpad and dump without crashing.
+// - load values into breakpad and crash.
+// - log values to the console.
+// But this is mostly Chromium-level stuff.
+
+} // namespace debug
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_CONTENT_DEBUG_LOGGING_H_
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 6ba22d8..8f9bb72 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -42,6 +42,7 @@
#include "content/common/web_database_observer_impl.h"
#include "content/public/common/compositor_util.h"
#include "content/public/common/content_constants.h"
+#include "content/public/common/content_debug_logging.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/renderer_preferences.h"
@@ -192,6 +193,18 @@ void AddHistogramSample(void* hist, int sample) {
histogram->Add(sample);
}
+void RecordMsg(int bug_id, const std::string& msg) {
+ RenderThreadImpl::current()->Send(
+ new ViewHostMsg_ContentDebugRecordMsg(bug_id, msg));
+}
+
+bool GetMessages(int bug_id, std::vector<std::string>* msgs) {
+ bool handled = false;
+ RenderThreadImpl::current()->Send(
+ new ViewHostMsg_ContentDebugGetMessages(bug_id, &handled, msgs));
+ return handled;
+}
+
} // namespace
class RenderThreadImpl::GpuVDAContextLostCallback
@@ -273,6 +286,8 @@ void RenderThreadImpl::Init() {
lazy_tls.Pointer()->Set(this);
+ content::debug::RegisterMessageHandlers(RecordMsg, GetMessages);
+
#if defined(OS_WIN)
// If you are running plugins in this thread you need COM active but in
// the normal case you don't.
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;
}