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

Side by Side Diff: content/browser/ppapi_plugin_process_host.cc

Issue 10919169: Change how PepperMessageFilter is constructed, to simplify its use. (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 "content/browser/ppapi_plugin_process_host.h" 5 #include "content/browser/ppapi_plugin_process_host.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 PpapiPluginProcessHost::~PpapiPluginProcessHost() { 69 PpapiPluginProcessHost::~PpapiPluginProcessHost() {
70 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") 70 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "")
71 << "~PpapiPluginProcessHost()"; 71 << "~PpapiPluginProcessHost()";
72 CancelRequests(); 72 CancelRequests();
73 } 73 }
74 74
75 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( 75 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost(
76 const content::PepperPluginInfo& info, 76 const content::PepperPluginInfo& info,
77 const FilePath& profile_data_directory, 77 const FilePath& profile_data_directory,
78 net::HostResolver* host_resolver) { 78 int render_process_id) {
79 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost( 79 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost(
80 info, profile_data_directory, host_resolver); 80 info, profile_data_directory, render_process_id);
81 if (plugin_host->Init(info)) 81 if (plugin_host->Init(info))
82 return plugin_host; 82 return plugin_host;
83 83
84 NOTREACHED(); // Init is not expected to fail. 84 NOTREACHED(); // Init is not expected to fail.
85 return NULL; 85 return NULL;
86 } 86 }
87 87
88 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( 88 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost(
89 const content::PepperPluginInfo& info) { 89 const content::PepperPluginInfo& info) {
90 PpapiPluginProcessHost* plugin_host = 90 PpapiPluginProcessHost* plugin_host =
(...skipping 18 matching lines...) Expand all
109 return; 109 return;
110 } 110 }
111 111
112 // We already have an open channel, send a request right away to plugin. 112 // We already have an open channel, send a request right away to plugin.
113 RequestPluginChannel(client); 113 RequestPluginChannel(client);
114 } 114 }
115 115
116 PpapiPluginProcessHost::PpapiPluginProcessHost( 116 PpapiPluginProcessHost::PpapiPluginProcessHost(
117 const content::PepperPluginInfo& info, 117 const content::PepperPluginInfo& info,
118 const FilePath& profile_data_directory, 118 const FilePath& profile_data_directory,
119 net::HostResolver* host_resolver) 119 int render_process_id)
120 : network_observer_(new PluginNetworkObserver(this)), 120 : network_observer_(new PluginNetworkObserver(this)),
121 profile_data_directory_(profile_data_directory), 121 profile_data_directory_(profile_data_directory),
122 is_broker_(false) { 122 is_broker_(false) {
123 process_.reset(new BrowserChildProcessHostImpl( 123 process_.reset(new BrowserChildProcessHostImpl(
124 content::PROCESS_TYPE_PPAPI_PLUGIN, this)); 124 content::PROCESS_TYPE_PPAPI_PLUGIN, this));
125 125
126 filter_ = new PepperMessageFilter(PepperMessageFilter::PLUGIN, 126 filter_ = new PepperMessageFilter(PepperMessageFilter::PLUGIN,
127 host_resolver); 127 render_process_id);
128 128
129 ppapi::PpapiPermissions permissions(info.permissions); 129 ppapi::PpapiPermissions permissions(info.permissions);
130 host_impl_ = new content::BrowserPpapiHostImpl(this, permissions); 130 host_impl_ = new content::BrowserPpapiHostImpl(this, permissions);
131 131
132 file_filter_ = new PepperTrustedFileMessageFilter( 132 file_filter_ = new PepperTrustedFileMessageFilter(
133 process_->GetData().id, info.name, profile_data_directory); 133 process_->GetData().id, info.name, profile_data_directory);
134 134
135 process_->GetHost()->AddFilter(filter_.get()); 135 process_->GetHost()->AddFilter(filter_.get());
136 process_->GetHost()->AddFilter(file_filter_.get()); 136 process_->GetHost()->AddFilter(file_filter_.get());
137 process_->GetHost()->AddFilter(host_impl_.get()); 137 process_->GetHost()->AddFilter(host_impl_.get());
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 if (sent_requests_.empty()) 301 if (sent_requests_.empty())
302 return; 302 return;
303 303
304 // All requests should be processed FIFO, so the next item in the 304 // All requests should be processed FIFO, so the next item in the
305 // sent_requests_ queue should be the one that the plugin just created. 305 // sent_requests_ queue should be the one that the plugin just created.
306 Client* client = sent_requests_.front(); 306 Client* client = sent_requests_.front();
307 sent_requests_.pop(); 307 sent_requests_.pop();
308 308
309 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); 309 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id);
310 } 310 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698