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

Side by Side Diff: ppapi/host/ppapi_host.cc

Issue 10909241: Generate dumps for relevant renderers when users kill a hung pepper plugin. (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
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 "ppapi/host/ppapi_host.h" 5 #include "ppapi/host/ppapi_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/host/host_factory.h" 9 #include "ppapi/host/host_factory.h"
10 #include "ppapi/host/host_message_context.h" 10 #include "ppapi/host/host_message_context.h"
11 #include "ppapi/host/instance_message_filter.h" 11 #include "ppapi/host/instance_message_filter.h"
12 #include "ppapi/host/resource_host.h" 12 #include "ppapi/host/resource_host.h"
13 #include "ppapi/proxy/ppapi_messages.h" 13 #include "ppapi/proxy/ppapi_messages.h"
14 #include "ppapi/proxy/resource_message_params.h" 14 #include "ppapi/proxy/resource_message_params.h"
15 #include "ppapi/shared_impl/host_resource.h" 15 #include "ppapi/shared_impl/host_resource.h"
16 #include "ppapi/shared_impl/ppapi_message_tracker.h"
16 17
17 namespace ppapi { 18 namespace ppapi {
18 namespace host { 19 namespace host {
19 20
20 namespace { 21 namespace {
21 22
22 // Put a cap on the maximum number of resources so we don't explode if the 23 // Put a cap on the maximum number of resources so we don't explode if the
23 // renderer starts spamming us. 24 // renderer starts spamming us.
24 const size_t kMaxResourcesPerPlugin = 1 << 14; 25 const size_t kMaxResourcesPerPlugin = 1 << 14;
25 26
26 } // namespace 27 } // namespace
27 28
28 PpapiHost::PpapiHost(IPC::Sender* sender, 29 PpapiHost::PpapiHost(IPC::Sender* sender,
29 const PpapiPermissions& perms) 30 const PpapiPermissions& perms)
30 : sender_(sender), 31 : sender_(sender),
31 permissions_(perms) { 32 permissions_(perms) {
32 } 33 }
33 34
34 PpapiHost::~PpapiHost() { 35 PpapiHost::~PpapiHost() {
35 // Delete these explicitly before destruction since then the host is still 36 // Delete these explicitly before destruction since then the host is still
36 // technically alive in case one of the filters accesses us from the 37 // technically alive in case one of the filters accesses us from the
37 // destructor. 38 // destructor.
38 instance_message_filters_.clear(); 39 instance_message_filters_.clear();
39 } 40 }
40 41
41 bool PpapiHost::Send(IPC::Message* msg) { 42 bool PpapiHost::Send(IPC::Message* msg) {
43 ScopedTrackPpapiMessage track_ppapi_message;
42 return sender_->Send(msg); 44 return sender_->Send(msg);
43 } 45 }
44 46
45 bool PpapiHost::OnMessageReceived(const IPC::Message& msg) { 47 bool PpapiHost::OnMessageReceived(const IPC::Message& msg) {
48 ScopedTrackPpapiMessage track_ppapi_message;
46 bool handled = true; 49 bool handled = true;
47 IPC_BEGIN_MESSAGE_MAP(PpapiHost, msg) 50 IPC_BEGIN_MESSAGE_MAP(PpapiHost, msg)
48 IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCall, 51 IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCall,
49 OnHostMsgResourceCall) 52 OnHostMsgResourceCall)
50 IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCreated, 53 IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCreated,
51 OnHostMsgResourceCreated) 54 OnHostMsgResourceCreated)
52 IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceDestroyed, 55 IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceDestroyed,
53 OnHostMsgResourceDestroyed) 56 OnHostMsgResourceDestroyed)
54 IPC_MESSAGE_UNHANDLED(handled = false) 57 IPC_MESSAGE_UNHANDLED(handled = false)
55 IPC_END_MESSAGE_MAP() 58 IPC_END_MESSAGE_MAP()
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 resources_.erase(found); 152 resources_.erase(found);
150 } 153 }
151 154
152 ResourceHost* PpapiHost::GetResourceHost(PP_Resource resource) { 155 ResourceHost* PpapiHost::GetResourceHost(PP_Resource resource) {
153 ResourceMap::iterator found = resources_.find(resource); 156 ResourceMap::iterator found = resources_.find(resource);
154 return found == resources_.end() ? NULL : found->second.get(); 157 return found == resources_.end() ? NULL : found->second.get();
155 } 158 }
156 159
157 } // namespace host 160 } // namespace host
158 } // namespace ppapi 161 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698