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

Side by Side Diff: chrome/ppapi_plugin/ppapi_thread.h

Issue 6628019: Ensure that PP_Instance values are unique within a plugin process in addition... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/pepper_plugin_registry.cc ('k') | chrome/ppapi_plugin/ppapi_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ 5 #ifndef CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_
6 #define CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ 6 #define CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/process.h" 10 #include "base/process.h"
11 #include "base/scoped_native_library.h" 11 #include "base/scoped_native_library.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "content/common/child_thread.h" 14 #include "content/common/child_thread.h"
15 #include "ppapi/c/pp_module.h" 15 #include "ppapi/c/pp_module.h"
16 #include "ppapi/proxy/dispatcher.h" 16 #include "ppapi/proxy/dispatcher.h"
17 17
18 class FilePath; 18 class FilePath;
19 19
20 namespace IPC { 20 namespace IPC {
21 struct ChannelHandle; 21 struct ChannelHandle;
22 } 22 }
23 23
24 namespace pp { 24 namespace pp {
25 namespace proxy { 25 namespace proxy {
26 class PluginDispatcher; 26 class PluginDispatcher;
27 } 27 }
28 } 28 }
29 29
30 class PpapiThread : public ChildThread { 30 class PpapiThread : public ChildThread,
31 public pp::proxy::Dispatcher::Delegate {
31 public: 32 public:
32 PpapiThread(); 33 PpapiThread();
33 ~PpapiThread(); 34 ~PpapiThread();
34 35
35 private: 36 private:
36 // ChildThread overrides. 37 // ChildThread overrides.
37 virtual bool OnMessageReceived(const IPC::Message& msg); 38 virtual bool OnMessageReceived(const IPC::Message& msg);
38 39
40 // Dispatcher::Delegate implementation.
41 virtual MessageLoop* GetIPCMessageLoop();
42 virtual base::WaitableEvent* GetShutdownEvent();
43 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet();
44
39 // Message handlers. 45 // Message handlers.
40 void OnMsgLoadPlugin(const FilePath& path); 46 void OnMsgLoadPlugin(const FilePath& path);
41 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, 47 void OnMsgCreateChannel(base::ProcessHandle host_process_handle,
42 int renderer_id); 48 int renderer_id);
43 49
44 // Sets up the channel to the given renderer. On success, returns true and 50 // Sets up the channel to the given renderer. On success, returns true and
45 // fills the given ChannelHandle with the information from the new channel. 51 // fills the given ChannelHandle with the information from the new channel.
46 bool SetupRendererChannel(base::ProcessHandle host_process_handle, 52 bool SetupRendererChannel(base::ProcessHandle host_process_handle,
47 int renderer_id, 53 int renderer_id,
48 IPC::ChannelHandle* handle); 54 IPC::ChannelHandle* handle);
49 55
50 base::ScopedNativeLibrary library_; 56 base::ScopedNativeLibrary library_;
51 57
52 pp::proxy::Dispatcher::GetInterfaceFunc get_plugin_interface_; 58 pp::proxy::Dispatcher::GetInterfaceFunc get_plugin_interface_;
53 59
54 // Local concept of the module ID. Some functions take this. It's necessary 60 // Local concept of the module ID. Some functions take this. It's necessary
55 // for the in-process PPAPI to handle this properly, but for proxied it's 61 // for the in-process PPAPI to handle this properly, but for proxied it's
56 // unnecessary. The proxy talking to multiple renderers means that each 62 // unnecessary. The proxy talking to multiple renderers means that each
57 // renderer has a different idea of what the module ID is for this plugin. 63 // renderer has a different idea of what the module ID is for this plugin.
58 // To force people to "do the right thing" we generate a random module ID 64 // To force people to "do the right thing" we generate a random module ID
59 // and pass it around as necessary. 65 // and pass it around as necessary.
60 PP_Module local_pp_module_; 66 PP_Module local_pp_module_;
61 67
68 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet.
69 std::set<PP_Instance> globally_seen_instance_ids_;
70
62 DISALLOW_COPY_AND_ASSIGN(PpapiThread); 71 DISALLOW_COPY_AND_ASSIGN(PpapiThread);
63 }; 72 };
64 73
65 #endif // CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_ 74 #endif // CHROME_PPAPI_PLUGIN_PPAPI_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/common/pepper_plugin_registry.cc ('k') | chrome/ppapi_plugin/ppapi_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698