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

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

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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
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 <stddef.h>
8
7 #include <string> 9 #include <string>
8 #include <utility> 10 #include <utility>
9 11
10 #include "base/base_switches.h" 12 #include "base/base_switches.h"
11 #include "base/command_line.h" 13 #include "base/command_line.h"
12 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/macros.h"
13 #include "base/metrics/field_trial.h" 16 #include "base/metrics/field_trial.h"
14 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "build/build_config.h"
16 #include "content/browser/browser_child_process_host_impl.h" 20 #include "content/browser/browser_child_process_host_impl.h"
17 #include "content/browser/plugin_service_impl.h" 21 #include "content/browser/plugin_service_impl.h"
18 #include "content/browser/renderer_host/render_message_filter.h" 22 #include "content/browser/renderer_host/render_message_filter.h"
19 #include "content/common/child_process_host_impl.h" 23 #include "content/common/child_process_host_impl.h"
20 #include "content/common/child_process_messages.h" 24 #include "content/common/child_process_messages.h"
21 #include "content/common/content_switches_internal.h" 25 #include "content/common/content_switches_internal.h"
22 #include "content/public/browser/content_browser_client.h" 26 #include "content/public/browser/content_browser_client.h"
23 #include "content/public/common/content_constants.h" 27 #include "content/public/common/content_constants.h"
24 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
25 #include "content/public/common/pepper_plugin_info.h" 29 #include "content/public/common/pepper_plugin_info.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (plugin_host->Init(info)) 185 if (plugin_host->Init(info))
182 return plugin_host; 186 return plugin_host;
183 187
184 NOTREACHED(); // Init is not expected to fail. 188 NOTREACHED(); // Init is not expected to fail.
185 return NULL; 189 return NULL;
186 } 190 }
187 191
188 // static 192 // static
189 void PpapiPluginProcessHost::DidCreateOutOfProcessInstance( 193 void PpapiPluginProcessHost::DidCreateOutOfProcessInstance(
190 int plugin_process_id, 194 int plugin_process_id,
191 int32 pp_instance, 195 int32_t pp_instance,
192 const PepperRendererInstanceData& instance_data) { 196 const PepperRendererInstanceData& instance_data) {
193 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { 197 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
194 if (iter->process_.get() && 198 if (iter->process_.get() &&
195 iter->process_->GetData().id == plugin_process_id) { 199 iter->process_->GetData().id == plugin_process_id) {
196 // Found the plugin. 200 // Found the plugin.
197 iter->host_impl_->AddInstance(pp_instance, instance_data); 201 iter->host_impl_->AddInstance(pp_instance, instance_data);
198 return; 202 return;
199 } 203 }
200 } 204 }
201 // We'll see this passed with a 0 process ID for the browser tag stuff that 205 // We'll see this passed with a 0 process ID for the browser tag stuff that
202 // is currently in the process of being removed. 206 // is currently in the process of being removed.
203 // 207 //
204 // TODO(brettw) When old browser tag impl is removed 208 // TODO(brettw) When old browser tag impl is removed
205 // (PepperPluginDelegateImpl::CreateBrowserPluginModule passes a 0 plugin 209 // (PepperPluginDelegateImpl::CreateBrowserPluginModule passes a 0 plugin
206 // process ID) this should be converted to a NOTREACHED(). 210 // process ID) this should be converted to a NOTREACHED().
207 DCHECK(plugin_process_id == 0) 211 DCHECK(plugin_process_id == 0)
208 << "Renderer sent a bad plugin process host ID"; 212 << "Renderer sent a bad plugin process host ID";
209 } 213 }
210 214
211 // static 215 // static
212 void PpapiPluginProcessHost::DidDeleteOutOfProcessInstance( 216 void PpapiPluginProcessHost::DidDeleteOutOfProcessInstance(
213 int plugin_process_id, 217 int plugin_process_id,
214 int32 pp_instance) { 218 int32_t pp_instance) {
215 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { 219 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
216 if (iter->process_.get() && 220 if (iter->process_.get() &&
217 iter->process_->GetData().id == plugin_process_id) { 221 iter->process_->GetData().id == plugin_process_id) {
218 // Found the plugin. 222 // Found the plugin.
219 iter->host_impl_->DeleteInstance(pp_instance); 223 iter->host_impl_->DeleteInstance(pp_instance);
220 return; 224 return;
221 } 225 }
222 } 226 }
223 // Note: It's possible that the plugin process has already been deleted by 227 // Note: It's possible that the plugin process has already been deleted by
224 // the time this message is received. For example, it could have crashed. 228 // the time this message is received. For example, it could have crashed.
225 // That's OK, we can just ignore this message. 229 // That's OK, we can just ignore this message.
226 } 230 }
227 231
228 // static 232 // static
229 void PpapiPluginProcessHost::OnPluginInstanceThrottleStateChange( 233 void PpapiPluginProcessHost::OnPluginInstanceThrottleStateChange(
230 int plugin_process_id, 234 int plugin_process_id,
231 int32 pp_instance, 235 int32_t pp_instance,
232 bool is_throttled) { 236 bool is_throttled) {
233 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { 237 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
234 if (iter->process_.get() && 238 if (iter->process_.get() &&
235 iter->process_->GetData().id == plugin_process_id) { 239 iter->process_->GetData().id == plugin_process_id) {
236 // Found the plugin. 240 // Found the plugin.
237 iter->host_impl_->OnThrottleStateChanged(pp_instance, is_throttled); 241 iter->host_impl_->OnThrottleStateChanged(pp_instance, is_throttled);
238 return; 242 return;
239 } 243 }
240 } 244 }
241 // Note: It's possible that the plugin process has already been deleted by 245 // Note: It's possible that the plugin process has already been deleted by
(...skipping 26 matching lines...) Expand all
268 272
269 // We already have an open channel, send a request right away to plugin. 273 // We already have an open channel, send a request right away to plugin.
270 RequestPluginChannel(client); 274 RequestPluginChannel(client);
271 } 275 }
272 276
273 PpapiPluginProcessHost::PpapiPluginProcessHost( 277 PpapiPluginProcessHost::PpapiPluginProcessHost(
274 const PepperPluginInfo& info, 278 const PepperPluginInfo& info,
275 const base::FilePath& profile_data_directory) 279 const base::FilePath& profile_data_directory)
276 : profile_data_directory_(profile_data_directory), 280 : profile_data_directory_(profile_data_directory),
277 is_broker_(false) { 281 is_broker_(false) {
278 uint32 base_permissions = info.permissions; 282 uint32_t base_permissions = info.permissions;
279 283
280 // We don't have to do any whitelisting for APIs in this process host, so 284 // We don't have to do any whitelisting for APIs in this process host, so
281 // don't bother passing a browser context or document url here. 285 // don't bother passing a browser context or document url here.
282 if (GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( 286 if (GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs(
283 NULL, GURL())) 287 NULL, GURL()))
284 base_permissions |= ppapi::PERMISSION_DEV_CHANNEL; 288 base_permissions |= ppapi::PERMISSION_DEV_CHANNEL;
285 permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions); 289 permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions);
286 290
287 process_.reset(new BrowserChildProcessHostImpl( 291 process_.reset(new BrowserChildProcessHostImpl(
288 PROCESS_TYPE_PPAPI_PLUGIN, this)); 292 PROCESS_TYPE_PPAPI_PLUGIN, this));
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) 459 IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg)
456 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, 460 IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated,
457 OnRendererPluginChannelCreated) 461 OnRendererPluginChannelCreated)
458 IPC_MESSAGE_UNHANDLED(handled = false) 462 IPC_MESSAGE_UNHANDLED(handled = false)
459 IPC_END_MESSAGE_MAP() 463 IPC_END_MESSAGE_MAP()
460 DCHECK(handled); 464 DCHECK(handled);
461 return handled; 465 return handled;
462 } 466 }
463 467
464 // Called when the browser <--> plugin channel has been established. 468 // Called when the browser <--> plugin channel has been established.
465 void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) { 469 void PpapiPluginProcessHost::OnChannelConnected(int32_t peer_pid) {
466 // This will actually load the plugin. Errors will actually not be reported 470 // This will actually load the plugin. Errors will actually not be reported
467 // back at this point. Instead, the plugin will fail to establish the 471 // back at this point. Instead, the plugin will fail to establish the
468 // connections when we request them on behalf of the renderer(s). 472 // connections when we request them on behalf of the renderer(s).
469 Send(new PpapiMsg_LoadPlugin(plugin_path_, permissions_)); 473 Send(new PpapiMsg_LoadPlugin(plugin_path_, permissions_));
470 474
471 // Process all pending channel requests from the renderers. 475 // Process all pending channel requests from the renderers.
472 for (size_t i = 0; i < pending_requests_.size(); i++) 476 for (size_t i = 0; i < pending_requests_.size(); i++)
473 RequestPluginChannel(pending_requests_[i]); 477 RequestPluginChannel(pending_requests_[i]);
474 pending_requests_.clear(); 478 pending_requests_.clear();
475 } 479 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // sent_requests_ queue should be the one that the plugin just created. 516 // sent_requests_ queue should be the one that the plugin just created.
513 Client* client = sent_requests_.front(); 517 Client* client = sent_requests_.front();
514 sent_requests_.pop(); 518 sent_requests_.pop();
515 519
516 const ChildProcessData& data = process_->GetData(); 520 const ChildProcessData& data = process_->GetData();
517 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 521 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
518 data.id); 522 data.id);
519 } 523 }
520 524
521 } // namespace content 525 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.h ('k') | content/browser/presentation/presentation_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698