OLD | NEW |
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/renderer/plugin_channel_host.h" | 5 #include "content/renderer/plugin_channel_host.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "content/common/child_process.h" | 9 #include "content/common/child_process.h" |
10 #include "content/common/npobject_base.h" | 10 #include "content/common/npobject_base.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
30 #include "base/debug/stack_trace.h" | 30 #include "base/debug/stack_trace.h" |
31 #include "base/mac/crash_logging.h" | 31 #include "base/mac/crash_logging.h" |
32 #include "base/sys_string_conversions.h" | 32 #include "base/sys_string_conversions.h" |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 // Breakpad key for the RemoveRoute() backtrace. | 36 // Breakpad key for the RemoveRoute() backtrace. |
37 const char* kRemoveRouteTraceKey = "remove_route_bt"; | 37 const char* kRemoveRouteTraceKey = "remove_route_bt"; |
38 | 38 |
| 39 // Breakpad key for the OnChannelError() backtrace. |
| 40 const char* kChannelErrorTraceKey = "channel_error_bt"; |
| 41 |
39 // GetRemoveTrackingFlag() exposes this so that | 42 // GetRemoveTrackingFlag() exposes this so that |
40 // WebPluginDelegateProxy::Initialize() can do scoped set/reset. When | 43 // WebPluginDelegateProxy::Initialize() can do scoped set/reset. When |
41 // true, RemoveRoute() knows WBDP::Initialize() is on the stack, and | 44 // true, RemoveRoute() knows WBDP::Initialize() is on the stack, and |
42 // records the backtrace. | 45 // records the backtrace. |
43 bool remove_tracking = false; | 46 bool remove_tracking = false; |
44 | 47 |
45 } // namespace | 48 } // namespace |
46 #endif | 49 #endif |
47 | 50 |
48 // A simple MessageFilter that will ignore all messages and respond to sync | 51 // A simple MessageFilter that will ignore all messages and respond to sync |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 base::TimeTicks start_time(base::TimeTicks::Now()); | 198 base::TimeTicks start_time(base::TimeTicks::Now()); |
196 bool result = NPChannelBase::Send(msg); | 199 bool result = NPChannelBase::Send(msg); |
197 UMA_HISTOGRAM_TIMES("Plugin.SyncMessageTime", | 200 UMA_HISTOGRAM_TIMES("Plugin.SyncMessageTime", |
198 base::TimeTicks::Now() - start_time); | 201 base::TimeTicks::Now() - start_time); |
199 return result; | 202 return result; |
200 } | 203 } |
201 return NPChannelBase::Send(msg); | 204 return NPChannelBase::Send(msg); |
202 } | 205 } |
203 | 206 |
204 void PluginChannelHost::OnChannelError() { | 207 void PluginChannelHost::OnChannelError() { |
| 208 #if defined(OS_MACOSX) |
| 209 if (remove_tracking) { |
| 210 base::debug::StackTrace trace; |
| 211 size_t count = 0; |
| 212 const void* const* addresses = trace.Addresses(&count); |
| 213 base::mac::SetCrashKeyFromAddresses( |
| 214 base::SysUTF8ToNSString(kChannelErrorTraceKey), addresses, count); |
| 215 } |
| 216 #endif |
| 217 |
205 NPChannelBase::OnChannelError(); | 218 NPChannelBase::OnChannelError(); |
206 | 219 |
207 for (ProxyMap::iterator iter = proxies_.begin(); | 220 for (ProxyMap::iterator iter = proxies_.begin(); |
208 iter != proxies_.end(); iter++) { | 221 iter != proxies_.end(); iter++) { |
209 iter->second->OnChannelError(); | 222 iter->second->OnChannelError(); |
210 } | 223 } |
211 | 224 |
212 proxies_.clear(); | 225 proxies_.clear(); |
213 } | 226 } |
OLD | NEW |