diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 16:52:58 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 16:52:58 +0000 |
commit | 184808f27fbc5cf8dc4a9c637d644bda31c6cfe8 (patch) | |
tree | 0db99fde76ca2142910775f750596e458c5353fc /content/ppapi_plugin/ppapi_thread.h | |
parent | 254004a393625cbcf09254e1ce127319f8a3addd (diff) | |
download | chromium_src-184808f27fbc5cf8dc4a9c637d644bda31c6cfe8.zip chromium_src-184808f27fbc5cf8dc4a9c637d644bda31c6cfe8.tar.gz chromium_src-184808f27fbc5cf8dc4a9c637d644bda31c6cfe8.tar.bz2 |
Move ppapi_plugin to content.
TBR=brettw
Review URL: http://codereview.chromium.org/6679041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/ppapi_plugin/ppapi_thread.h')
-rw-r--r-- | content/ppapi_plugin/ppapi_thread.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h new file mode 100644 index 0000000..2ccc4be --- /dev/null +++ b/content/ppapi_plugin/ppapi_thread.h @@ -0,0 +1,74 @@ +// Copyright (c) 2011 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_PPAPI_PLUGIN_PPAPI_THREAD_H_ +#define CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/process.h" +#include "base/scoped_native_library.h" +#include "base/scoped_ptr.h" +#include "build/build_config.h" +#include "content/common/child_thread.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/proxy/dispatcher.h" + +class FilePath; + +namespace IPC { +struct ChannelHandle; +} + +namespace pp { +namespace proxy { +class PluginDispatcher; +} +} + +class PpapiThread : public ChildThread, + public pp::proxy::Dispatcher::Delegate { + public: + PpapiThread(); + ~PpapiThread(); + + private: + // ChildThread overrides. + virtual bool OnMessageReceived(const IPC::Message& msg); + + // Dispatcher::Delegate implementation. + virtual MessageLoop* GetIPCMessageLoop(); + virtual base::WaitableEvent* GetShutdownEvent(); + virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet(); + + // Message handlers. + void OnMsgLoadPlugin(const FilePath& path); + void OnMsgCreateChannel(base::ProcessHandle host_process_handle, + int renderer_id); + + // Sets up the channel to the given renderer. On success, returns true and + // fills the given ChannelHandle with the information from the new channel. + bool SetupRendererChannel(base::ProcessHandle host_process_handle, + int renderer_id, + IPC::ChannelHandle* handle); + + base::ScopedNativeLibrary library_; + + pp::proxy::Dispatcher::GetInterfaceFunc get_plugin_interface_; + + // Local concept of the module ID. Some functions take this. It's necessary + // for the in-process PPAPI to handle this properly, but for proxied it's + // unnecessary. The proxy talking to multiple renderers means that each + // renderer has a different idea of what the module ID is for this plugin. + // To force people to "do the right thing" we generate a random module ID + // and pass it around as necessary. + PP_Module local_pp_module_; + + // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet. + std::set<PP_Instance> globally_seen_instance_ids_; + + DISALLOW_COPY_AND_ASSIGN(PpapiThread); +}; + +#endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ |