Skip to content

Commit

Permalink
Revert "Add mojo interfaces for pepper plugins."
Browse files Browse the repository at this point in the history
This reverts commit 3da5569.

Reason for revert: Suspected to be causing widespread failures in PPAPI/Pepper tests on Win and Linux dbg bots:

https://ci.chromium.org/p/chromium/builders/ci/Win7%20Tests%20%28dbg%29%281%29/87226
https://ci.chromium.org/p/chromium/builders/ci/Linux%20Tests%20%28dbg%29%281%29/93584

Sample failure output:

[ RUN      ] OutOfProcessPPAPITest.Instance_ExecuteScript
[18698:18698:1211/141847.386588:INFO:content_main_runner_impl.cc(1027)] Chrome is running in full browser mode.

DevTools listening on ws://127.0.0.1:37739/devtools/browser/565ba965-de40-4715-8905-11c22e1cfcca
[18698:18811:1211/141848.175888:WARNING:render_message_filter.cc(137)] Could not find tid
[18698:18811:1211/141848.265958:WARNING:render_message_filter.cc(137)] Could not find tid
[18698:18698:1211/141848.839793:INFO:CONSOLE(1)] "Uncaught Error: plugin exception", source: file:///b/s/w/ir/ppapi/tests/test_case.html?testcase=Instance_ExecuteScript (1)
[18698:18698:1211/141848.844552:INFO:CONSOLE(1)] "Uncaught TypeError: document.doesntExist is not a function", source: file:///b/s/w/ir/ppapi/tests/test_case.html?testcase=Instance_ExecuteScript (1)
[18698:18698:1211/141848.855716:INFO:CONSOLE(176)] "ExecuteScript finished in 0.073 seconds.", source: file:///b/s/w/ir/ppapi/tests/test_case.html?testcase=Instance_ExecuteScript (176)
Received signal 11 <unknown> 000000000000
#0 0x7f89c0dca89f base::debug::CollectStackTrace()
#1 0x7f89c0b5409a base::debug::StackTrace::StackTrace()
#2 0x7f89c0b54055 base::debug::StackTrace::StackTrace()
#3 0x7f89c0dca36b base::debug::(anonymous namespace)::StackDumpSignalHandler()
#4 0x7f8993ea2390 (/lib/x86_64-linux-gnu/libpthread-2.23.so+0x1138f)
#5 0x7f89b142c419 std::__Cr::default_delete<>::operator()()
#6 0x7f89b142c3ea std::__Cr::unique_ptr<>::reset()
#7 0x7f89b142c379 std::__Cr::unique_ptr<>::~unique_ptr()
#8 0x7f89b142c16d mojo::internal::AssociatedInterfacePtrState<>::~AssociatedInterfacePtrState()
#9 0x7f89b142cb95 mojo::AssociatedRemote<>::~AssociatedRemote()
#10 0x7f89b142afab content::PepperPluginInstance::~PepperPluginInstance()
#11 0x7f89b2587d8e content::PepperPluginInstanceImpl::~PepperPluginInstanceImpl()
#12 0x7f89b2587e69 content::PepperPluginInstanceImpl::~PepperPluginInstanceImpl()
#13 0x7f89b25350f8 base::RefCounted<>::DeleteInternal<>()
#14 0x7f89b25350c5 base::DefaultRefCountedTraits<>::Destruct()
#15 0x7f89b25350a3 base::RefCounted<>::Release()
#16 0x7f89b2535069 scoped_refptr<>::Release()
#17 0x7f89b253020a scoped_refptr<>::~scoped_refptr()
#18 0x7f89b25ce3f3 scoped_refptr<>::reset()
#19 0x7f89b25cd8dd _ZN13scoped_refptrIN7content24PepperPluginInstanceImplEEaSEDn
#20 0x7f89b25cbe83 content::PepperWebPluginImpl::Destroy()
#21 0x7f89a7414e41 blink::WebPluginContainerImpl::Dispose()
#22 0x7f89a593f32d blink::HTMLFrameOwnerElement::PluginDisposeSuspendScope::PerformDeferredPluginDispose()
#23 0x7f89a4f5d292 blink::HTMLFrameOwnerElement::PluginDisposeSuspendScope::~PluginDisposeSuspendScope()
#24 0x7f89a4f58862 blink::ContainerNode::RemoveChild()
#25 0x7f89a5111cbb blink::Node::removeChild()
#26 0x7f89a70daabe blink::(anonymous namespace)::RemoveChildOperationCallback()
#27 0x7f899e0c0780 v8::internal::FunctionCallbackArguments::Call()
#28 0x7f899e0bedcd v8::internal::(anonymous namespace)::HandleApiCallHelper<>()
#29 0x7f899e0bcfe5 v8::internal::Builtin_Impl_HandleApiCall()
#30 0x7f899e0bcaa9 v8::internal::Builtin_HandleApiCall()
#31 0x7f899dae513f Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit
  r8: 00000f84ee181f88  r9: 0000000000000000 r10: 0000000000000259 r11: 00007f8996194690
 r12: 00007f89a70da600 r13: 0000132400000000 r14: 00007ffc8c8eef10 r15: 00007ffc8c8eef10
  di: 00007f89b3e98918  si: 00007f89b3e98918  bp: 00007ffc8c8ee710  bx: 00007f89c0f52440
  dx: 00000f84ee181f90  ax: 00007f89b2587db0  cx: 0000000000000000  sp: 00007ffc8c8ee6f0
  ip: 00007f89b142c419 efl: 0000000000010206 cgf: 002b000000000033 erf: 0000000000000000
 trp: 000000000000000d msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
../../content/public/test/no_renderer_crashes_assertion.cc:101: Failure
Failed
Unexpected termination of a renderer process; status: 1, exit_code: 256
Stack trace:
#0 0x55ec1877d394 content::NoRendererCrashesAssertion::Observe()
#1 0x7f3d4cf1ead6 content::NotificationServiceImpl::Notify()
#2 0x7f3d4d3a3986 content::RenderProcessHostImpl::ProcessDied()
#3 0x7f3d4d3a46be content::RenderProcessHostImpl::OnChannelError()
#4 0x7f3d60fa392d IPC::ChannelProxy::Context::OnDispatchError()
#5 0x7f3d60fa987f base::internal::FunctorTraits<>::Invoke<>()
#6 0x7f3d60fa97c1 base::internal::InvokeHelper<>::MakeItSo<>()
#7 0x7f3d60fa9742 _ZN4base8internal7InvokerINS0_9BindStateIMN3IPC12ChannelProxy7ContextEFvvEJ13scoped_refptrIS5_EEEEFvvEE7RunImplIS7_NSt4__Cr5tupleIJS9_EEEJLm0EEEEvOT_OT0_NSE_16integer_sequenceImJXspT1_EEEE
#8 0x7f3d60fa96ec base::internal::Invoker<>::RunOnce()
#9 0x7f3d5ca3c0d1 _ZNO4base12OnceCallbackIFvvEE3RunEv
#10 0x7f3d5cc03df2 base::TaskAnnotator::RunTask()
#11 0x7f3d5cc49eba base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl()
#12 0x7f3d5cc49685 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()
#13 0x7f3d5cc4a119 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()
#14 0x7f3d5caf69f1 base::MessagePumpGlib::HandleDispatch()
#15 0x7f3d5caf7141 base::(anonymous namespace)::WorkSourceDispatch()
#16 0x7f3d2f683197 g_main_context_dispatch
#17 0x7f3d2f6833f0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2+0x4a3ef)
#18 0x7f3d2f68349c g_main_context_iteration
#19 0x7f3d5caf6b00 base::MessagePumpGlib::Run()
#20 0x7f3d5cc4a740 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run()
#21 0x7f3d5cb95d75 base::RunLoop::Run()
#22 0x55ec187b836a content::RunThisRunLoop()
#23 0x55ec187b831f content::RunMessageLoop()
#24 0x55ec18760320 content::JavascriptTestObserver::Run()
#25 0x55ec16a8b567 content::PPAPITestBase::RunTestURL()
#26 0x55ec16a8b48e content::PPAPITestBase::RunTest()
#27 0x55ec16a84f2a content::(anonymous namespace)::OutOfProcessPPAPITest_Instance_ExecuteScript_Test::RunTestOnMainThread()
#28 0x55ec18719264 content::BrowserTestBase::ProxyRunTestOnMainThreadLoop()
#29 0x55ec1871cf2a base::internal::FunctorTraits<>::Invoke<>()
#30 0x55ec1871cea1 base::internal::InvokeHelper<>::MakeItSo<>()
#31 0x55ec1871ce37 _ZN4base8internal7InvokerINS0_9BindStateIMN7content15BrowserTestBaseEFvvEJNS0_17UnretainedWrapperIS4_EEEEEFvvEE7RunImplIS6_NSt4__Cr5tupleIJS8_EEEJLm0EEEEvOT_OT0_NSD_16integer_sequenceImJXspT1_EEEE
#32 0x55ec1871cddc base::internal::Invoker<>::RunOnce()
#33 0x55ec157bbac1 _ZNO4base12OnceCallbackIFvvEE3RunEv
#34 0x55ec18a331cc content::ShellBrowserMainParts::PreMainMessageLoopRun()
#35 0x7f3d4c5f5282 content::BrowserMainLoop::PreMainMessageLoopRun()
chromium#36 0x7f3d4c5ff18a base::internal::FunctorTraits<>::Invoke<>()
#37 0x7f3d4c5ff0a1 base::internal::InvokeHelper<>::MakeItSo<>()
#38 0x7f3d4c5ff027 _ZN4base8internal7InvokerINS0_9BindStateIMN7content15BrowserMainLoopEFivEJNS0_17UnretainedWrapperIS4_EEEEEFivEE7RunImplIS6_NSt4__Cr5tupleIJS8_EEEJLm0EEEEiOT_OT0_NSD_16integer_sequenceImJXspT1_EEEE
chromium#39 0x7f3d4c5fefcc base::internal::Invoker<>::RunOnce()
#40 0x7f3d4c9d5b31 _ZNO4base12OnceCallbackIFivEE3RunEv
#41 0x7f3d4d812b16 content::StartupTaskRunner::RunAllTasksNow()
chromium#42 0x7f3d4c5f3b8a content::BrowserMainLoop::CreateStartupTasks()
#43 0x7f3d4c602df0 content::BrowserMainRunnerImpl::Initialize()
#44 0x7f3d4c5f0d64 content::BrowserMain()
#45 0x7f3d4e7bcbc6 content::RunBrowserProcessMain()
#46 0x7f3d4e7be1e9 content::ContentMainRunnerImpl::RunBrowser()
#47 0x7f3d4e7bdad7 content::ContentMainRunnerImpl::Run()
#48 0x7f3d4e7bae05 content::RunContentProcess()
#49 0x7f3d4e7bb79d content::ContentMain()
#50 0x55ec18718d5a content::BrowserTestBase::SetUp()
#51 0x55ec1865a9ac content::ContentBrowserTest::SetUp()
#52 0x55ec16a8ba95 content::OutOfProcessPPAPITest::SetUp()
#53 0x55ec17363a6b testing::internal::HandleSehExceptionsInMethodIfSupported<>()
#54 0x55ec173547f7 testing::internal::HandleExceptionsInMethodIfSupported<>()

Note the ~AssociatedRemote from ~PepperPluginInstanceImpl, which I think was introduced in this CL.  This also seems to be the only plugin-related change in the blamelist (https://chromium.googlesource.com/chromium/src/+log/6828ef78f2200e4bac3280186c7520ab65b2d7f8%5E..21468f4304510a432e3376d9d72ec67962f39723?pretty=fuller&n=)

Original change's description:
> Add mojo interfaces for pepper plugins.
>
> This adds some base plumbing for pepper plugin instance handling. The
> pepper renderer code allocates and manages the PepperPluginInstanceImpl,
> this creates the correct encapsulation moving code out of RenderFrameImpl.
>
> On the browser side a PepperPluginInstance is created to handle the
> messages and relay them to the WebContentsImpl which use to handle
> the processing of Pepper messages.
>
> BUG=1157519
>
> Change-Id: I24941bb7eecef56a90bbf961e6396101c8d3c785
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2585627
> Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Bill Budge <bbudge@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#836239}

TBR=dcheng@chromium.org,bbudge@chromium.org,dtapuska@chromium.org,arthursonzogni@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Iddd93694ebe0611abef6c74b57667554b51e26fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1157519
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587769
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836330}
  • Loading branch information
Alex Moshchuk authored and Chromium LUCI CQ committed Dec 12, 2020
1 parent 5fe5f2b commit 3fab481
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 190 deletions.
9 changes: 0 additions & 9 deletions content/browser/renderer_host/render_frame_host_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,15 +652,6 @@ class CONTENT_EXPORT RenderFrameHostDelegate {
GetActiveTopLevelDocumentsInBrowsingContextGroup(
RenderFrameHostImpl* render_frame_host);

#if BUILDFLAG(ENABLE_PLUGINS)
virtual void OnPepperInstanceCreated(RenderFrameHostImpl* source,
int32_t pp_instance) {}
virtual void OnPepperStartsPlayback(RenderFrameHostImpl* source,
int32_t pp_instance) {}
virtual void OnPepperStopsPlayback(RenderFrameHostImpl* source,
int32_t pp_instance) {}
#endif

protected:
virtual ~RenderFrameHostDelegate() = default;
};
Expand Down
64 changes: 0 additions & 64 deletions content/browser/renderer_host/render_frame_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -870,42 +870,6 @@ void VerifyThatBrowserAndRendererCalculatedOriginsToCommitMatch(

} // namespace

#if BUILDFLAG(ENABLE_PLUGINS)
class PepperPluginInstance : public mojom::PepperPluginInstanceHost {
public:
PepperPluginInstance(
int32_t instance_id,
RenderFrameHostImpl* frame_host,
mojo::PendingAssociatedRemote<mojom::PepperPluginInstance> instance,
mojo::PendingAssociatedReceiver<mojom::PepperPluginInstanceHost> host)
: instance_id_(instance_id),
frame_host_(frame_host),
receiver_(this, std::move(host)),
remote_(std::move(instance)) {
frame_host_->delegate()->OnPepperInstanceCreated(frame_host_, instance_id);
remote_.set_disconnect_handler(
base::BindOnce(&RenderFrameHostImpl::PepperInstanceClosed,
base::Unretained(frame_host), instance_id_));
}
~PepperPluginInstance() override = default;

// mojom::PepperPluginInstanceHost overrides.
void StartsPlayback() override {
frame_host_->delegate()->OnPepperStartsPlayback(frame_host_, instance_id_);
}

void StopsPlayback() override {
frame_host_->delegate()->OnPepperStopsPlayback(frame_host_, instance_id_);
}

private:
int32_t const instance_id_;
RenderFrameHostImpl* const frame_host_;
mojo::AssociatedReceiver<mojom::PepperPluginInstanceHost> receiver_;
mojo::AssociatedRemote<mojom::PepperPluginInstance> remote_;
};
#endif // BUILDFLAG(ENABLE_PLUGINS)

class RenderFrameHostImpl::DroppedInterfaceRequestLogger
: public blink::mojom::BrowserInterfaceBroker {
public:
Expand Down Expand Up @@ -6907,18 +6871,6 @@ void RenderFrameHostImpl::SetUpMojoIfNeeded() {
GetProcess()->GetStoragePartition()->GetFileSystemContext(),
ChromeBlobStorageContext::GetFor(GetProcess()->GetBrowserContext())));

#if BUILDFLAG(ENABLE_PLUGINS)
associated_registry_->AddInterface(base::BindRepeating(
[](RenderFrameHostImpl* impl,
mojo::PendingAssociatedReceiver<mojom::PepperHost> receiver) {
impl->pepper_host_receiver_.Bind(std::move(receiver));
impl->pepper_host_receiver_.SetFilter(
impl->CreateMessageFilterForAssociatedReceiver(
mojom::PepperHost::Name_));
},
base::Unretained(this)));
#endif

mojo::PendingRemote<mojom::FrameFactory> frame_factory;
GetProcess()->BindReceiver(frame_factory.InitWithNewPipeAndPassReceiver());
mojo::Remote<mojom::FrameFactory>(std::move(frame_factory))
Expand Down Expand Up @@ -10131,22 +10083,6 @@ void RenderFrameHostImpl::Clone(
cookie_observers_.Add(this, std::move(observer));
}

#if BUILDFLAG(ENABLE_PLUGINS)
void RenderFrameHostImpl::InstanceCreated(
int32_t instance_id,
mojo::PendingAssociatedRemote<mojom::PepperPluginInstance> instance,
mojo::PendingAssociatedReceiver<mojom::PepperPluginInstanceHost> host) {
pepper_instance_map_.emplace(
instance_id,
std::make_unique<PepperPluginInstance>(
instance_id, this, std::move(instance), std::move(host)));
}

void RenderFrameHostImpl::PepperInstanceClosed(int32_t instance_id) {
pepper_instance_map_.erase(instance_id);
}
#endif // BUILDFLAG(ENABLE_PLUGINS)

void RenderFrameHostImpl::OnCookiesAccessed(
network::mojom::CookieAccessDetailsPtr details) {
EmitSameSiteCookiesDeprecationWarning(this, details);
Expand Down
26 changes: 0 additions & 26 deletions content/browser/renderer_host/render_frame_host_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@
#include "media/mojo/mojom/remoting.mojom-forward.h"
#endif

#if BUILDFLAG(ENABLE_PLUGINS)
#include "content/common/pepper_plugin.mojom.h"
#endif

class GURL;

namespace blink {
Expand Down Expand Up @@ -215,7 +211,6 @@ class KeepAliveHandleFactory;
class MediaInterfaceProxy;
class NavigationEntryImpl;
class NavigationRequest;
class PepperPluginInstance;
class PermissionServiceContext;
class Portal;
class PrefetchedSignedExchangeCache;
Expand Down Expand Up @@ -264,9 +259,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
public network::CSPContext,
public blink::mojom::LocalMainFrameHost,
public ui::AXActionHandlerBase,
#if BUILDFLAG(ENABLE_PLUGINS)
public mojom::PepperHost,
#endif // BUILDFLAG(ENABLE_PLUGINS)
public network::mojom::CookieAccessObserver {
public:
using AXTreeSnapshotCallback =
Expand Down Expand Up @@ -1871,10 +1863,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
return accessibility_fatal_error_count_;
}

#if BUILDFLAG(ENABLE_PLUGINS)
void PepperInstanceClosed(int32_t instance_id);
#endif

protected:
friend class RenderFrameHostFactory;

Expand Down Expand Up @@ -2152,15 +2140,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
void Clone(mojo::PendingReceiver<network::mojom::CookieAccessObserver>
observer) override;

#if BUILDFLAG(ENABLE_PLUGINS)
// mojom::PepperHost overrides:
void InstanceCreated(
int32_t instance_id,
mojo::PendingAssociatedRemote<mojom::PepperPluginInstance> instance,
mojo::PendingAssociatedReceiver<mojom::PepperPluginInstanceHost> host)
override;
#endif // BUILDFLAG(ENABLE_PLUGINS)

// Resets any waiting state of this RenderFrameHost that is no longer
// relevant.
void ResetWaitingState();
Expand Down Expand Up @@ -3051,11 +3030,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
mojo::AssociatedReceiver<mojom::DomAutomationControllerHost>
dom_automation_controller_receiver_{this};

#if BUILDFLAG(ENABLE_PLUGINS)
mojo::AssociatedReceiver<mojom::PepperHost> pepper_host_receiver_{this};
std::map<int32_t, std::unique_ptr<PepperPluginInstance>> pepper_instance_map_;
#endif

std::unique_ptr<KeepAliveHandleFactory> keep_alive_handle_factory_;
base::TimeDelta keep_alive_timeout_;

Expand Down
6 changes: 6 additions & 0 deletions content/browser/web_contents/web_contents_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1148,9 +1148,15 @@ bool WebContentsImpl::OnMessageReceived(RenderFrameHostImpl* render_frame_host,
bool handled = true;
#if BUILDFLAG(ENABLE_PLUGINS)
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContentsImpl, message, render_frame_host)
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceCreated,
OnPepperInstanceCreated)
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceDeleted,
OnPepperInstanceDeleted)
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung)
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStartsPlayback,
OnPepperStartsPlayback)
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStopsPlayback,
OnPepperStopsPlayback)
IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
Expand Down
12 changes: 4 additions & 8 deletions content/browser/web_contents/web_contents_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -771,14 +771,6 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
std::vector<RenderFrameHostImpl*>
GetActiveTopLevelDocumentsInBrowsingContextGroup(
RenderFrameHostImpl* render_frame_host) override;
#if BUILDFLAG(ENABLE_PLUGINS)
void OnPepperInstanceCreated(RenderFrameHostImpl* source,
int32_t pp_instance) override;
void OnPepperStartsPlayback(RenderFrameHostImpl* source,
int32_t pp_instance) override;
void OnPepperStopsPlayback(RenderFrameHostImpl* source,
int32_t pp_instance) override;
#endif

// RenderViewHostDelegate ----------------------------------------------------
RenderViewHostDelegateView* GetDelegateView() override;
Expand Down Expand Up @@ -1508,12 +1500,16 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
int minimum_percent,
int maximum_percent);
#if BUILDFLAG(ENABLE_PLUGINS)
void OnPepperInstanceCreated(RenderFrameHostImpl* source,
int32_t pp_instance);
void OnPepperInstanceDeleted(RenderFrameHostImpl* source,
int32_t pp_instance);
void OnPepperPluginHung(RenderFrameHostImpl* source,
int plugin_child_id,
const base::FilePath& path,
bool is_hung);
void OnPepperStartsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
void OnPepperStopsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
void OnPluginCrashed(RenderFrameHostImpl* source,
const base::FilePath& plugin_path,
base::ProcessId plugin_pid);
Expand Down
4 changes: 0 additions & 4 deletions content/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,6 @@ mojom("mojo_bindings") {
enabled_features += [ "clang_profiling_inside_sandbox" ]
}

if (enable_plugins) {
sources += [ "pepper_plugin.mojom" ]
}

cpp_typemaps = [
{
types = [
Expand Down
15 changes: 15 additions & 0 deletions content/common/frame_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ IPC_MESSAGE_ROUTED2(FrameMsg_SetPepperVolume,
// Messages sent from the renderer to the browser.

#if BUILDFLAG(ENABLE_PLUGINS)
// Notification sent from a renderer to the browser that a Pepper plugin
// instance is created in the DOM.
IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperInstanceCreated,
int32_t /* pp_instance */)

// Notification sent from a renderer to the browser that a Pepper plugin
// instance is deleted from the DOM.
IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperInstanceDeleted,
Expand All @@ -281,6 +286,16 @@ IPC_MESSAGE_ROUTED2(FrameHostMsg_PluginCrashed,
base::FilePath /* plugin_path */,
base::ProcessId /* plugin_pid */)

// Notification sent from a renderer to the browser that a Pepper plugin
// instance has started playback.
IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStartsPlayback,
int32_t /* pp_instance */)

// Notification sent from a renderer to the browser that a Pepper plugin
// instance has stopped playback.
IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
int32_t /* pp_instance */)

// Return information about a plugin for the given URL and MIME
// type. If there is no matching plugin, |found| is false.
// |actual_mime_type| is the actual mime type supported by the
Expand Down
26 changes: 0 additions & 26 deletions content/common/pepper_plugin.mojom

This file was deleted.

14 changes: 6 additions & 8 deletions content/renderer/pepper/pepper_audio_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,18 @@ void PepperAudioController::OnPepperInstanceDeleted() {
void PepperAudioController::NotifyPlaybackStopsOnEmpty() {
DCHECK(instance_);

mojom::PepperPluginInstanceHost* instance_host =
instance_->GetPepperPluginInstanceHost();
if (instance_host)
instance_host->StopsPlayback();
RenderFrameImpl* render_frame = instance_->render_frame();
if (render_frame)
render_frame->PepperStopsPlayback(instance_);
}

void PepperAudioController::StartPlaybackIfFirstInstance() {
DCHECK(instance_);

if (audio_output_hosts_.empty() && ppb_audios_.empty()) {
mojom::PepperPluginInstanceHost* instance_host =
instance_->GetPepperPluginInstanceHost();
if (instance_host)
instance_host->StartsPlayback();
RenderFrameImpl* render_frame = instance_->render_frame();
if (render_frame)
render_frame->PepperStartsPlayback(instance_);
}
}

Expand Down
4 changes: 1 addition & 3 deletions content/renderer/pepper/pepper_plugin_instance_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,7 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl(
module_->InstanceCreated(this);

if (render_frame_) { // NULL in tests or if the frame has been destroyed.
render_frame_->PepperInstanceCreated(
this, pepper_receiver_.BindNewEndpointAndPassRemote(),
pepper_host_remote_.BindNewEndpointAndPassReceiver());
render_frame_->PepperInstanceCreated(this);
view_data_.is_page_visible =
!render_frame_->GetLocalRootWebFrameWidget()->IsHidden();

Expand Down
17 changes: 1 addition & 16 deletions content/renderer/pepper/pepper_plugin_instance_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@
#include "cc/paint/paint_canvas.h"
#include "components/viz/common/resources/transferable_resource.h"
#include "content/common/content_export.h"
#include "content/common/pepper_plugin.mojom.h"
#include "content/public/renderer/pepper_plugin_instance.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h"
#include "gin/handle.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "ppapi/c/dev/pp_cursor_type_dev.h"
#include "ppapi/c/dev/ppp_printing_dev.h"
#include "ppapi/c/dev/ppp_text_input_dev.h"
Expand Down Expand Up @@ -122,8 +119,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
public PepperPluginInstance,
public ppapi::PPB_Instance_Shared,
public cc::TextureLayerClient,
public RenderFrameObserver,
public mojom::PepperPluginInstance {
public RenderFrameObserver {
public:
// Create and return a PepperPluginInstanceImpl object which supports the most
// recent version of PPP_Instance possible by querying the given
Expand All @@ -139,17 +135,9 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// Currently only used in tests.
static PepperPluginInstanceImpl* GetForTesting(PP_Instance instance_id);

// Returns the associated RenderFrameImpl. Can be null (in tests) or if the
// frame has been destroyed.
RenderFrameImpl* render_frame() const { return render_frame_; }
PluginModule* module() const { return module_.get(); }

// Returns the associated mojo host channel to the browser. Can be null if
// `render_frame()` returns null.
mojom::PepperPluginInstanceHost* GetPepperPluginInstanceHost() {
return pepper_host_remote_.get();
}

blink::WebPluginContainer* container() const { return container_; }

// Returns the PP_Instance uniquely identifying this instance. Guaranteed
Expand Down Expand Up @@ -856,9 +844,6 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// progress.
base::string16 composition_text_;

mojo::AssociatedRemote<mojom::PepperPluginInstanceHost> pepper_host_remote_;
mojo::AssociatedReceiver<mojom::PepperPluginInstance> pepper_receiver_{this};

// We use a weak ptr factory for scheduling DidChangeView events so that we
// can tell whether updates are pending and consolidate them. When there's
// already a weak ptr pending (HasWeakPtrs is true), code should update the
Expand Down
Loading

0 comments on commit 3fab481

Please sign in to comment.