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

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

Issue 61063003: Keep NaCl plugins used in app background pages alive when active. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: working prototype Created 7 years, 1 month 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 PpapiPluginProcessHost::PpapiPluginProcessHost( 206 PpapiPluginProcessHost::PpapiPluginProcessHost(
207 const PepperPluginInfo& info, 207 const PepperPluginInfo& info,
208 const base::FilePath& profile_data_directory) 208 const base::FilePath& profile_data_directory)
209 : permissions_( 209 : permissions_(
210 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)), 210 ppapi::PpapiPermissions::GetForCommandLine(info.permissions)),
211 profile_data_directory_(profile_data_directory), 211 profile_data_directory_(profile_data_directory),
212 is_broker_(false) { 212 is_broker_(false) {
213 process_.reset(new BrowserChildProcessHostImpl( 213 process_.reset(new BrowserChildProcessHostImpl(
214 PROCESS_TYPE_PPAPI_PLUGIN, this)); 214 PROCESS_TYPE_PPAPI_PLUGIN, this));
215 215
216 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, 216 host_impl_ = new BrowserPpapiHostImpl(NULL, this, permissions_, info.name,
217 info.path, profile_data_directory, 217 info.path, profile_data_directory,
218 false /* in_process */, 218 false /* in_process */,
219 false /* external_plugin */)); 219 false /* external_plugin */);
220 220
221 filter_ = new PepperMessageFilter(); 221 filter_ = new PepperMessageFilter();
222 process_->AddFilter(filter_.get()); 222 process_->AddFilter(filter_.get());
223 process_->GetHost()->AddFilter(host_impl_->message_filter().get()); 223 process_->GetHost()->AddFilter(host_impl_->message_filter().get());
224 224
225 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get()); 225 GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get());
226 226
227 // Only request network status updates if the plugin has dev permissions. 227 // Only request network status updates if the plugin has dev permissions.
228 if (permissions_.HasPermission(ppapi::PERMISSION_DEV)) 228 if (permissions_.HasPermission(ppapi::PERMISSION_DEV))
229 network_observer_.reset(new PluginNetworkObserver(this)); 229 network_observer_.reset(new PluginNetworkObserver(this));
230 } 230 }
231 231
232 PpapiPluginProcessHost::PpapiPluginProcessHost() 232 PpapiPluginProcessHost::PpapiPluginProcessHost()
233 : is_broker_(true) { 233 : is_broker_(true) {
234 process_.reset(new BrowserChildProcessHostImpl( 234 process_.reset(new BrowserChildProcessHostImpl(
235 PROCESS_TYPE_PPAPI_BROKER, this)); 235 PROCESS_TYPE_PPAPI_BROKER, this));
236 236
237 ppapi::PpapiPermissions permissions; // No permissions. 237 ppapi::PpapiPermissions permissions; // No permissions.
238 // The plugin name, path and profile data directory shouldn't be needed for 238 // The plugin name, path and profile data directory shouldn't be needed for
239 // the broker. 239 // the broker.
240 host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, 240 host_impl_ = new BrowserPpapiHostImpl(NULL, this, permissions,
dmichael (off chromium) 2013/11/06 22:39:21 This looks kind of messy, since that argument is o
scheib 2013/11/15 01:22:17 Done.
241 std::string(), base::FilePath(), 241 std::string(), base::FilePath(),
242 base::FilePath(), 242 base::FilePath(),
243 false /* in_process */, 243 false /* in_process */,
244 false /* external_plugin */)); 244 false /* external_plugin */);
245 } 245 }
246 246
247 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { 247 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
248 plugin_path_ = info.path; 248 plugin_path_ = info.path;
249 if (info.name.empty()) { 249 if (info.name.empty()) {
250 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); 250 process_->SetName(plugin_path_.BaseName().LossyDisplayName());
251 } else { 251 } else {
252 process_->SetName(UTF8ToUTF16(info.name)); 252 process_->SetName(UTF8ToUTF16(info.name));
253 } 253 }
254 254
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // sent_requests_ queue should be the one that the plugin just created. 426 // sent_requests_ queue should be the one that the plugin just created.
427 Client* client = sent_requests_.front(); 427 Client* client = sent_requests_.front();
428 sent_requests_.pop(); 428 sent_requests_.pop();
429 429
430 const ChildProcessData& data = process_->GetData(); 430 const ChildProcessData& data = process_->GetData();
431 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 431 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
432 data.id); 432 data.id);
433 } 433 }
434 434
435 } // namespace content 435 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698