| 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/browser/ppapi_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" | 47 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" |
| 48 #include "content/common/sandbox_win.h" | 48 #include "content/common/sandbox_win.h" |
| 49 #include "sandbox/win/src/process_mitigations.h" | 49 #include "sandbox/win/src/process_mitigations.h" |
| 50 #include "sandbox/win/src/sandbox_policy.h" | 50 #include "sandbox/win/src/sandbox_policy.h" |
| 51 #include "ui/display/win/dpi.h" | 51 #include "ui/display/win/dpi.h" |
| 52 #include "ui/gfx/font_render_params.h" | 52 #include "ui/gfx/font_render_params.h" |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 namespace content { | 55 namespace content { |
| 56 | 56 |
| 57 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | |
| 58 ZygoteHandle g_ppapi_zygote; | |
| 59 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | |
| 60 | |
| 61 // NOTE: changes to this class need to be reviewed by the security team. | 57 // NOTE: changes to this class need to be reviewed by the security team. |
| 62 class PpapiPluginSandboxedProcessLauncherDelegate | 58 class PpapiPluginSandboxedProcessLauncherDelegate |
| 63 : public content::SandboxedProcessLauncherDelegate { | 59 : public content::SandboxedProcessLauncherDelegate { |
| 64 public: | 60 public: |
| 65 explicit PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker) | 61 explicit PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker) |
| 66 #if (defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)) || \ | 62 #if (defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)) || \ |
| 67 defined(OS_WIN) | 63 defined(OS_WIN) |
| 68 : is_broker_(is_broker) | 64 : is_broker_(is_broker) |
| 69 #endif | 65 #endif |
| 70 { | 66 { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const PepperPluginInfo& info) { | 193 const PepperPluginInfo& info) { |
| 198 PpapiPluginProcessHost* plugin_host = | 194 PpapiPluginProcessHost* plugin_host = |
| 199 new PpapiPluginProcessHost(); | 195 new PpapiPluginProcessHost(); |
| 200 if (plugin_host->Init(info)) | 196 if (plugin_host->Init(info)) |
| 201 return plugin_host; | 197 return plugin_host; |
| 202 | 198 |
| 203 NOTREACHED(); // Init is not expected to fail. | 199 NOTREACHED(); // Init is not expected to fail. |
| 204 return NULL; | 200 return NULL; |
| 205 } | 201 } |
| 206 | 202 |
| 207 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | |
| 208 // static | |
| 209 void PpapiPluginProcessHost::EarlyZygoteLaunch() { | |
| 210 DCHECK(!g_ppapi_zygote); | |
| 211 g_ppapi_zygote = CreateZygote(); | |
| 212 } | |
| 213 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | |
| 214 | |
| 215 // static | 203 // static |
| 216 void PpapiPluginProcessHost::DidCreateOutOfProcessInstance( | 204 void PpapiPluginProcessHost::DidCreateOutOfProcessInstance( |
| 217 int plugin_process_id, | 205 int plugin_process_id, |
| 218 int32_t pp_instance, | 206 int32_t pp_instance, |
| 219 const PepperRendererInstanceData& instance_data) { | 207 const PepperRendererInstanceData& instance_data) { |
| 220 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { | 208 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { |
| 221 if (iter->process_.get() && | 209 if (iter->process_.get() && |
| 222 iter->process_->GetData().id == plugin_process_id) { | 210 iter->process_->GetData().id == plugin_process_id) { |
| 223 // Found the plugin. | 211 // Found the plugin. |
| 224 iter->host_impl_->AddInstance(pp_instance, instance_data); | 212 iter->host_impl_->AddInstance(pp_instance, instance_data); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 // sent_requests_ queue should be the one that the plugin just created. | 538 // sent_requests_ queue should be the one that the plugin just created. |
| 551 Client* client = sent_requests_.front(); | 539 Client* client = sent_requests_.front(); |
| 552 sent_requests_.pop(); | 540 sent_requests_.pop(); |
| 553 | 541 |
| 554 const ChildProcessData& data = process_->GetData(); | 542 const ChildProcessData& data = process_->GetData(); |
| 555 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 543 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
| 556 data.id); | 544 data.id); |
| 557 } | 545 } |
| 558 | 546 |
| 559 } // namespace content | 547 } // namespace content |
| OLD | NEW |