source: trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.h@ 350

Last change on this file since 350 was 348, checked in by dmik, 13 years ago

vendor: Add icedtea-web v1.1.2 to current.

File size: 4.7 KB
Line 
1/* IcedTeaNPPlugin.h
2
3 Copyright (C) 2009, 2010 Red Hat
4
5This file is part of IcedTea.
6
7IcedTea is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12IcedTea is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with IcedTea; see the file COPYING. If not, write to the
19Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2002110-1301 USA.
21
22Linking this library statically or dynamically with other modules is
23making a combined work based on this library. Thus, the terms and
24conditions of the GNU General Public License cover the whole
25combination.
26
27As a special exception, the copyright holders of this library give you
28permission to link this library with independent modules to produce an
29executable, regardless of the license terms of these independent
30modules, and to copy and distribute the resulting executable under
31terms of your choice, provided that you also meet, for each linked
32independent module, the terms and conditions of the license of that
33module. An independent module is a module which is not derived from
34or based on this library. If you modify this library, you may extend
35this exception to your version of the library, but you are not
36obligated to do so. If you do not wish to do so, delete this
37exception statement from your version. */
38
39#ifndef __ICEDTEANPPLUGIN_H__
40#define __ICEDTEANPPLUGIN_H__
41
42#if MOZILLA_VERSION_COLLAPSED < 1090100
43#include <nsThreadUtils.h>
44#else
45#include <npapi.h>
46#include <npruntime.h>
47#include <npfunctions.h>
48#endif
49
50// GLib includes.
51#include <glib.h>
52#include <glib/gstdio.h>
53
54// GTK includes.
55#include <gtk/gtk.h>
56
57#include "IcedTeaPluginUtils.h"
58#include "IcedTeaPluginRequestProcessor.h"
59
60// ITNPPluginData stores all the data associated with a single plugin
61// instance. A separate plugin instance is created for each <APPLET>
62// tag. For now, each plugin instance spawns its own applet viewer
63// process but this may need to change if we find pages containing
64// multiple applets that expect to be running in the same VM.
65struct ITNPPluginData
66{
67 // A unique identifier for this plugin window.
68 gchar* instance_id;
69 // The applet tag sent to Java side
70 gchar* applet_tag;
71 // Mutex to protect appletviewer_alive.
72 GMutex* appletviewer_mutex;
73 // Back-pointer to the plugin instance to which this data belongs.
74 // This should not be freed but instead simply set to NULL.
75 NPP owner;
76 // The address of the plugin window. This should not be freed but
77 // instead simply set to NULL.
78 gpointer window_handle;
79 // The last plugin window width sent to us by the browser.
80 guint32 window_width;
81 // The last plugin window height sent to us by the browser.
82 guint32 window_height;
83 // The source location for this instance
84 gchar* source;
85 // If this is an actual applet instance, or a dummy instance for static calls
86 bool is_applet_instance;
87};
88
89// Queue processing threads
90static pthread_t plugin_request_processor_thread1;
91static pthread_t plugin_request_processor_thread2;
92static pthread_t plugin_request_processor_thread3;
93
94// Condition on which the queue processor waits
95extern pthread_cond_t cond_message_available;
96
97// ID of plug-in thread
98extern pthread_t itnp_plugin_thread_id;
99
100/* Mutex around plugin async call queue ops */
101extern pthread_mutex_t pluginAsyncCallMutex;
102
103// debug switch
104extern int plugin_debug;
105
106// Browser function table.
107extern NPNetscapeFuncs browser_functions;
108
109// messages to the java side
110extern MessageBus* plugin_to_java_bus;
111
112// messages from the java side
113extern MessageBus* java_to_plugin_bus;
114
115// internal messages (e.g ones that need processing in main thread)
116//extern MessageBus* internal_bus;
117
118// subscribes to plugin_to_java_bus and sends messages over the link
119extern JavaMessageSender java_request_processor;
120
121// processes requests made to the plugin
122extern PluginRequestProcessor plugin_request_processor;
123
124/* Given an instance pointer, return its id */
125void get_instance_from_id(int id, NPP& instance);
126
127/* Given an instance id, return its pointer */
128int get_id_from_instance(NPP instance);
129
130/* Sends a message to the appletviewer */
131void plugin_send_message_to_appletviewer(gchar const* message);
132
133/* Returns an appropriate (package/object) scriptable npobject */
134NPObject* get_scriptable_object(NPP instance);
135
136/* Creates a new scriptable plugin object and returns it */
137NPObject* allocate_scriptable_object(NPP npp, NPClass *aClass);
138
139#endif /* __ICEDTEANPPLUGIN_H__ */
Note: See TracBrowser for help on using the repository browser.