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

Side by Side Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 2069853002: Ignore certain messages in plugin broker process if they are not sent by the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/ppapi_plugin/ppapi_thread.h" 5 #include "content/ppapi_plugin/ppapi_thread.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
438 ReportLoadResult(path, LOAD_SUCCESS); 438 ReportLoadResult(path, LOAD_SUCCESS);
439 } 439 }
440 440
441 void PpapiThread::OnCreateChannel(base::ProcessId renderer_pid, 441 void PpapiThread::OnCreateChannel(base::ProcessId renderer_pid,
442 int renderer_child_id, 442 int renderer_child_id,
443 bool incognito) { 443 bool incognito) {
444 IPC::ChannelHandle channel_handle; 444 IPC::ChannelHandle channel_handle;
445 445
446 if (!plugin_entry_points_.get_interface || // Plugin couldn't be loaded. 446 if (!plugin_entry_points_.get_interface || // Plugin couldn't be loaded.
447 !SetupRendererChannel(renderer_pid, renderer_child_id, incognito, 447 !SetupChannel(renderer_pid, renderer_child_id, incognito,
448 &channel_handle)) { 448 &channel_handle)) {
449 Send(new PpapiHostMsg_ChannelCreated(IPC::ChannelHandle())); 449 Send(new PpapiHostMsg_ChannelCreated(IPC::ChannelHandle()));
450 return; 450 return;
451 } 451 }
452 452
453 Send(new PpapiHostMsg_ChannelCreated(channel_handle)); 453 Send(new PpapiHostMsg_ChannelCreated(channel_handle));
454 } 454 }
455 455
456 void PpapiThread::OnSetNetworkState(bool online) { 456 void PpapiThread::OnSetNetworkState(bool online) {
457 // Note the browser-process side shouldn't send us these messages in the 457 // Note the browser-process side shouldn't send us these messages in the
458 // first unless the plugin has dev permissions, so we don't need to check 458 // first unless the plugin has dev permissions, so we don't need to check
(...skipping 17 matching lines...) Expand all
476 volatile int* null_pointer = nullptr; 476 volatile int* null_pointer = nullptr;
477 *null_pointer = 0; 477 *null_pointer = 0;
478 } 478 }
479 479
480 void PpapiThread::OnHang() { 480 void PpapiThread::OnHang() {
481 // Intentionally hang upon the request of the browser. 481 // Intentionally hang upon the request of the browser.
482 for (;;) 482 for (;;)
483 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); 483 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
484 } 484 }
485 485
486 bool PpapiThread::SetupRendererChannel(base::ProcessId renderer_pid, 486 bool PpapiThread::SetupChannel(base::ProcessId renderer_pid,
487 int renderer_child_id, 487 int renderer_child_id,
488 bool incognito, 488 bool incognito,
489 IPC::ChannelHandle* handle) { 489 IPC::ChannelHandle* handle) {
490 DCHECK(is_broker_ == (connect_instance_func_ != NULL)); 490 DCHECK(is_broker_ == (connect_instance_func_ != NULL));
491 IPC::ChannelHandle plugin_handle; 491 IPC::ChannelHandle plugin_handle;
492 plugin_handle.name = IPC::Channel::GenerateVerifiedChannelID( 492 plugin_handle.name = IPC::Channel::GenerateVerifiedChannelID(
493 base::StringPrintf( 493 base::StringPrintf(
494 "%d.r%d", base::GetCurrentProcId(), renderer_child_id)); 494 "%d.r%d", base::GetCurrentProcId(), renderer_child_id));
495 495
496 ppapi::proxy::ProxyChannel* dispatcher = NULL; 496 ppapi::proxy::ProxyChannel* dispatcher = NULL;
497 bool init_result = false; 497 bool init_result = false;
498 if (is_broker_) { 498 if (is_broker_) {
499 bool peer_is_browser = renderer_pid == base::kNullProcessId;
499 BrokerProcessDispatcher* broker_dispatcher = 500 BrokerProcessDispatcher* broker_dispatcher =
500 new BrokerProcessDispatcher(plugin_entry_points_.get_interface, 501 new BrokerProcessDispatcher(plugin_entry_points_.get_interface,
501 connect_instance_func_); 502 connect_instance_func_, peer_is_browser);
502 init_result = broker_dispatcher->InitBrokerWithChannel(this, 503 init_result = broker_dispatcher->InitBrokerWithChannel(this,
503 renderer_pid, 504 renderer_pid,
504 plugin_handle, 505 plugin_handle,
505 false); 506 false);
506 dispatcher = broker_dispatcher; 507 dispatcher = broker_dispatcher;
507 } else { 508 } else {
509 DCHECK_NE(base::kNullProcessId, renderer_pid);
bbudge 2016/06/14 23:16:53 I'm not very familiar with this part of Pepper, bu
yzshen1 2016/06/14 23:24:47 We get here because we get a create channel reques
bbudge 2016/06/14 23:42:16 Thanks for clarifying!
508 PluginProcessDispatcher* plugin_dispatcher = 510 PluginProcessDispatcher* plugin_dispatcher =
509 new PluginProcessDispatcher(plugin_entry_points_.get_interface, 511 new PluginProcessDispatcher(plugin_entry_points_.get_interface,
510 permissions_, 512 permissions_,
511 incognito); 513 incognito);
512 init_result = plugin_dispatcher->InitPluginWithChannel(this, 514 init_result = plugin_dispatcher->InitPluginWithChannel(this,
513 renderer_pid, 515 renderer_pid,
514 plugin_handle, 516 plugin_handle,
515 false); 517 false);
516 dispatcher = plugin_dispatcher; 518 dispatcher = plugin_dispatcher;
517 } 519 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 GetHistogramName(is_broker_, "LoadTime", path), 587 GetHistogramName(is_broker_, "LoadTime", path),
586 base::TimeDelta::FromMilliseconds(1), 588 base::TimeDelta::FromMilliseconds(1),
587 base::TimeDelta::FromSeconds(10), 589 base::TimeDelta::FromSeconds(10),
588 50, 590 50,
589 base::HistogramBase::kUmaTargetedHistogramFlag); 591 base::HistogramBase::kUmaTargetedHistogramFlag);
590 592
591 histogram->AddTime(load_time); 593 histogram->AddTime(load_time);
592 } 594 }
593 595
594 } // namespace content 596 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698