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

Side by Side Diff: content/plugin/plugin_thread.cc

Issue 10908130: Revert 155122 - Code to collect issue 97285 debugging info for crash reports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/common/content_debug_logging.h » ('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/plugin/plugin_thread.h" 5 #include "content/plugin/plugin_thread.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(TOOLKIT_GTK) 9 #if defined(TOOLKIT_GTK)
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
11 #elif defined(OS_MACOSX) 11 #elif defined(OS_MACOSX)
12 #include <CoreFoundation/CoreFoundation.h> 12 #include <CoreFoundation/CoreFoundation.h>
13 #endif 13 #endif
14 14
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/lazy_instance.h" 20 #include "base/lazy_instance.h"
21 #include "base/process_util.h" 21 #include "base/process_util.h"
22 #include "base/threading/thread_local.h" 22 #include "base/threading/thread_local.h"
23 #include "content/common/child_process.h" 23 #include "content/common/child_process.h"
24 #include "content/common/npobject_util.h" 24 #include "content/common/npobject_util.h"
25 #include "content/common/plugin_messages.h" 25 #include "content/common/plugin_messages.h"
26 #include "content/public/common/content_debug_logging.h"
27 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
28 #include "content/public/plugin/content_plugin_client.h" 27 #include "content/public/plugin/content_plugin_client.h"
29 #include "ipc/ipc_channel_handle.h" 28 #include "ipc/ipc_channel_handle.h"
30 #include "webkit/glue/webkit_glue.h" 29 #include "webkit/glue/webkit_glue.h"
31 #include "webkit/plugins/npapi/plugin_lib.h" 30 #include "webkit/plugins/npapi/plugin_lib.h"
32 #include "webkit/plugins/npapi/plugin_list.h" 31 #include "webkit/plugins/npapi/plugin_list.h"
33 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 32 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
34 33
35 #if defined(TOOLKIT_GTK) 34 #if defined(TOOLKIT_GTK)
36 #include "ui/gfx/gtk_util.h" 35 #include "ui/gfx/gtk_util.h"
(...skipping 25 matching lines...) Expand all
62 base::Bind(&EnsureTerminateMessageFilter::Terminate, this), 61 base::Bind(&EnsureTerminateMessageFilter::Terminate, this),
63 kPluginProcessTerminateTimeout); 62 kPluginProcessTerminateTimeout);
64 } 63 }
65 64
66 private: 65 private:
67 void Terminate() { 66 void Terminate() {
68 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); 67 base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
69 } 68 }
70 }; 69 };
71 70
72 void RecordMsg(int bug_id, const std::string& msg) {
73 PluginThread::current()->Send(
74 new PluginProcessHostMsg_ContentDebugRecordMsg(bug_id, msg));
75 }
76
77 bool GetMessages(int bug_id, std::vector<std::string>* msgs) {
78 bool handled = false;
79 PluginThread::current()->Send(
80 new PluginProcessHostMsg_ContentDebugGetMessages(
81 bug_id, &handled, msgs));
82 return handled;
83 }
84
85 } // namespace 71 } // namespace
86 72
87 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls = 73 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls =
88 LAZY_INSTANCE_INITIALIZER; 74 LAZY_INSTANCE_INITIALIZER;
89 75
90 PluginThread::PluginThread() 76 PluginThread::PluginThread()
91 : preloaded_plugin_module_(NULL) { 77 : preloaded_plugin_module_(NULL) {
92 FilePath plugin_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( 78 FilePath plugin_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath(
93 switches::kPluginPath); 79 switches::kPluginPath);
94 80
(...skipping 19 matching lines...) Expand all
114 100
115 // GTK after 2.18 resets the environment variable. But if we're using 101 // GTK after 2.18 resets the environment variable. But if we're using
116 // nspluginwrapper, that means it'll spawn its subprocess without the 102 // nspluginwrapper, that means it'll spawn its subprocess without the
117 // environment variable! So set it again. 103 // environment variable! So set it again.
118 setenv("GDK_NATIVE_WINDOWS", "1", 1); 104 setenv("GDK_NATIVE_WINDOWS", "1", 1);
119 } 105 }
120 106
121 ui::SetDefaultX11ErrorHandlers(); 107 ui::SetDefaultX11ErrorHandlers();
122 #endif 108 #endif
123 109
124 content::debug::RegisterMessageHandlers(RecordMsg, GetMessages);
125
126 PatchNPNFunctions(); 110 PatchNPNFunctions();
127 111
128 // Preload the library to avoid loading, unloading then reloading 112 // Preload the library to avoid loading, unloading then reloading
129 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL); 113 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL);
130 114
131 scoped_refptr<webkit::npapi::PluginLib> plugin( 115 scoped_refptr<webkit::npapi::PluginLib> plugin(
132 webkit::npapi::PluginLib::CreatePluginLib(plugin_path)); 116 webkit::npapi::PluginLib::CreatePluginLib(plugin_path));
133 if (plugin.get()) { 117 if (plugin.get()) {
134 plugin->NP_Initialize(); 118 plugin->NP_Initialize();
135 // For OOP plugins the plugin dll will be unloaded during process shutdown 119 // For OOP plugins the plugin dll will be unloaded during process shutdown
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (channel.get()) { 170 if (channel.get()) {
187 channel_handle.name = channel->channel_handle().name; 171 channel_handle.name = channel->channel_handle().name;
188 #if defined(OS_POSIX) 172 #if defined(OS_POSIX)
189 // On POSIX, pass the renderer-side FD. 173 // On POSIX, pass the renderer-side FD.
190 channel_handle.socket = 174 channel_handle.socket =
191 base::FileDescriptor(channel->TakeRendererFileDescriptor(), true); 175 base::FileDescriptor(channel->TakeRendererFileDescriptor(), true);
192 #endif 176 #endif
193 channel->set_incognito(incognito); 177 channel->set_incognito(incognito);
194 } 178 }
195 179
196 #if defined(OS_MACOSX)
197 content::debug::RecordMsg(97285, base::StringPrintf(
198 "OnCreateChannel({%s, %d})",
199 channel_handle.name.c_str(), channel_handle.socket.fd));
200 #endif
201 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); 180 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle));
202 } 181 }
203 182
204 void PluginThread::OnNotifyRenderersOfPendingShutdown() { 183 void PluginThread::OnNotifyRenderersOfPendingShutdown() {
205 PluginChannel::NotifyRenderersOfPendingShutdown(); 184 PluginChannel::NotifyRenderersOfPendingShutdown();
206 } 185 }
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/common/content_debug_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698