blob: e5349178ed2abd35fde3f677527926e54e1b83b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_
#define CONTENT_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_
#include "base/process/process_handle.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/ppp.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
namespace IPC {
struct ChannelHandle;
}
namespace content {
class PepperHungPluginFilter;
class PluginModule;
// This class wraps a dispatcher and has the same lifetime. A dispatcher has
// the same lifetime as a plugin module, which is longer than any particular
// RenderView or plugin instance.
class HostDispatcherWrapper {
public:
HostDispatcherWrapper(PluginModule* module,
base::ProcessId peer_pid,
int plugin_child_id,
const ppapi::PpapiPermissions& perms,
bool is_external);
virtual ~HostDispatcherWrapper();
bool Init(const IPC::ChannelHandle& channel_handle,
PP_GetInterface_Func local_get_interface,
const ppapi::Preferences& preferences,
PepperHungPluginFilter* filter);
// Implements GetInterface for the proxied plugin.
const void* GetProxiedInterface(const char* name);
// Notification to the out-of-process layer that the given plugin instance
// has been created. This will happen before the normal PPB_Instance method
// calls so the out-of-process code can set up the tracking information for
// the new instance.
void AddInstance(PP_Instance instance);
// Like AddInstance but removes the given instance. This is called after
// regular instance shutdown so the out-of-process code can clean up its
// tracking information.
void RemoveInstance(PP_Instance instance);
base::ProcessId peer_pid() { return peer_pid_; }
int plugin_child_id() { return plugin_child_id_; }
ppapi::proxy::HostDispatcher* dispatcher() { return dispatcher_.get(); }
private:
PluginModule* module_;
base::ProcessId peer_pid_;
// ID that the browser process uses to idetify the child process for the
// plugin. This isn't directly useful from our process (the renderer) except
// in messages to the browser to disambiguate plugins.
int plugin_child_id_;
ppapi::PpapiPermissions permissions_;
bool is_external_;
scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_;
scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_;
};
} // namespace content
#endif // CONTENT_RENDERER_PEPPER_HOST_DISPATCHER_WRAPPER_H_
|