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

Side by Side Diff: content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc

Issue 22923014: TCPSockets are switched to the new Pepper proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 7 years, 4 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/renderer_host/pepper/browser_ppapi_host_impl.h" 5 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
6 6
7 #include "content/browser/renderer_host/pepper/pepper_message_filter.h"
7 #include "content/browser/tracing/trace_message_filter.h" 8 #include "content/browser/tracing/trace_message_filter.h"
8 #include "content/common/pepper_renderer_instance_data.h" 9 #include "content/common/pepper_renderer_instance_data.h"
9 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
10 #include "content/public/common/process_type.h" 11 #include "content/public/common/process_type.h"
11 #include "ipc/ipc_message_macros.h" 12 #include "ipc/ipc_message_macros.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 // static 16 // static
16 BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess( 17 BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess(
17 IPC::Sender* sender, 18 IPC::Sender* sender,
18 ppapi::PpapiPermissions permissions, 19 ppapi::PpapiPermissions permissions,
19 base::ProcessHandle plugin_child_process, 20 base::ProcessHandle plugin_child_process,
20 IPC::ChannelProxy* channel, 21 IPC::ChannelProxy* channel,
21 net::HostResolver* host_resolver,
22 int render_process_id, 22 int render_process_id,
23 int render_view_id, 23 int render_view_id,
24 const base::FilePath& profile_directory) { 24 const base::FilePath& profile_directory) {
25 scoped_refptr<PepperMessageFilter> pepper_message_filter(
26 new PepperMessageFilter(permissions,
27 host_resolver,
28 render_process_id,
29 render_view_id));
30
31 // The plugin name and path shouldn't be needed for external plugins. 25 // The plugin name and path shouldn't be needed for external plugins.
32 BrowserPpapiHostImpl* browser_ppapi_host = 26 BrowserPpapiHostImpl* browser_ppapi_host =
33 new BrowserPpapiHostImpl(sender, permissions, std::string(), 27 new BrowserPpapiHostImpl(sender, permissions, std::string(),
34 base::FilePath(), profile_directory, true, 28 base::FilePath(), profile_directory, true);
35 pepper_message_filter);
36 browser_ppapi_host->set_plugin_process_handle(plugin_child_process); 29 browser_ppapi_host->set_plugin_process_handle(plugin_child_process);
37 30
38 channel->AddFilter(pepper_message_filter); 31 channel->AddFilter(PepperMessageFilter::CreateExternal(permissions));
yzshen1 2013/08/16 20:40:42 You should still put it in a scoped_refptr<> befor
ygorshenin1 2013/08/19 14:33:35 Done.
39 channel->AddFilter(browser_ppapi_host->message_filter().get()); 32 channel->AddFilter(browser_ppapi_host->message_filter().get());
40 channel->AddFilter(new TraceMessageFilter()); 33 channel->AddFilter(new TraceMessageFilter());
41 34
42 return browser_ppapi_host; 35 return browser_ppapi_host;
43 } 36 }
44 37
45 BrowserPpapiHostImpl::BrowserPpapiHostImpl( 38 BrowserPpapiHostImpl::BrowserPpapiHostImpl(
46 IPC::Sender* sender, 39 IPC::Sender* sender,
47 const ppapi::PpapiPermissions& permissions, 40 const ppapi::PpapiPermissions& permissions,
48 const std::string& plugin_name, 41 const std::string& plugin_name,
49 const base::FilePath& plugin_path, 42 const base::FilePath& plugin_path,
50 const base::FilePath& profile_data_directory, 43 const base::FilePath& profile_data_directory,
51 bool external_plugin, 44 bool external_plugin)
52 const scoped_refptr<PepperMessageFilter>& pepper_message_filter)
53 : ppapi_host_(new ppapi::host::PpapiHost(sender, permissions)), 45 : ppapi_host_(new ppapi::host::PpapiHost(sender, permissions)),
54 plugin_process_handle_(base::kNullProcessHandle), 46 plugin_process_handle_(base::kNullProcessHandle),
55 plugin_name_(plugin_name), 47 plugin_name_(plugin_name),
56 plugin_path_(plugin_path), 48 plugin_path_(plugin_path),
57 profile_data_directory_(profile_data_directory), 49 profile_data_directory_(profile_data_directory),
58 external_plugin_(external_plugin) { 50 external_plugin_(external_plugin) {
59 message_filter_ = new HostMessageFilter(ppapi_host_.get()); 51 message_filter_ = new HostMessageFilter(ppapi_host_.get());
60 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( 52 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
61 new ContentBrowserPepperHostFactory(this, pepper_message_filter))); 53 new ContentBrowserPepperHostFactory(this)));
62 } 54 }
63 55
64 BrowserPpapiHostImpl::~BrowserPpapiHostImpl() { 56 BrowserPpapiHostImpl::~BrowserPpapiHostImpl() {
65 // Notify the filter so it won't foward messages to us. 57 // Notify the filter so it won't foward messages to us.
66 message_filter_->OnHostDestroyed(); 58 message_filter_->OnHostDestroyed();
67 59
68 // Delete the host explicitly first. This shutdown will destroy the 60 // Delete the host explicitly first. This shutdown will destroy the
69 // resources, which may want to do cleanup in their destructors and expect 61 // resources, which may want to do cleanup in their destructors and expect
70 // their pointers to us to be valid. 62 // their pointers to us to be valid.
71 ppapi_host_.reset(); 63 ppapi_host_.reset();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 */ 151 */
160 return ppapi_host_->OnMessageReceived(msg); 152 return ppapi_host_->OnMessageReceived(msg);
161 } 153 }
162 154
163 void BrowserPpapiHostImpl::HostMessageFilter::OnHostDestroyed() { 155 void BrowserPpapiHostImpl::HostMessageFilter::OnHostDestroyed() {
164 DCHECK(ppapi_host_); 156 DCHECK(ppapi_host_);
165 ppapi_host_ = NULL; 157 ppapi_host_ = NULL;
166 } 158 }
167 159
168 } // namespace content 160 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698