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

Side by Side Diff: webkit/glue/plugins/pepper_var.h

Issue 3323005: Unrevert 58354, reland PPAPI with the instance test disabled. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | « webkit/glue/plugins/pepper_plugin_instance.cc ('k') | webkit/glue/plugins/pepper_var.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 WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_ 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_ 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 struct PP_Var; 10 struct PP_Var;
11 struct PPB_Var; 11 struct PPB_Var;
12 typedef struct NPObject NPObject; 12 typedef struct NPObject NPObject;
13 typedef struct _NPVariant NPVariant; 13 typedef struct _NPVariant NPVariant;
14 typedef void* NPIdentifier; 14 typedef void* NPIdentifier;
15 15
16 namespace pepper { 16 namespace pepper {
17 17
18 class String; 18 class String;
19 19
20 // There's no class implementing Var since it could represent a number of 20 // There's no class implementing Var since it could represent a number of
21 // objects. Instead, we just expose a getter for the interface implemented in 21 // objects. Instead, we just expose a getter for the interface implemented in
22 // the .cc file here. 22 // the .cc file here.
23 const PPB_Var* GetVarInterface(); 23 const PPB_Var* GetVarInterface();
24 24
25 // Returns a PP_Var of type object that wraps the given NPObject. Calling this 25 // Returns a PP_Var of type object that wraps the given NPObject. Calling this
26 // function multiple times given the same NPObject results in the same PP_Var. 26 // function multiple times given the same NPObject results in the same PP_Var.
27 PP_Var NPObjectToPPVar(NPObject* object); 27 PP_Var NPObjectToPPVar(NPObject* object);
28 28
29 // Returns a PP_Var that corresponds to the given NPVariant. The contents of
30 // the NPVariant will be copied unless the NPVariant corresponds to an object.
31 PP_Var NPVariantToPPVar(const NPVariant* variant);
32
29 // Returns the NPObject corresponding to the PP_Var. This pointer has not been 33 // Returns the NPObject corresponding to the PP_Var. This pointer has not been
30 // retained, so you should not call WebBindings::releaseObject unless you first 34 // retained, so you should not call WebBindings::releaseObject unless you first
31 // call WebBindings::retainObject. Returns NULL if the PP_Var is not an object 35 // call WebBindings::retainObject. Returns NULL if the PP_Var is not an object
32 // type. 36 // type.
33 NPObject* GetNPObject(PP_Var var); 37 NPObject* GetNPObject(PP_Var var);
34 38
35 // Returns a PP_Var of type string that contains a copy of the given string. 39 // Returns a PP_Var of type string that contains a copy of the given string.
36 // The input data must be valid UTF-8 encoded text. The return value will 40 // The input data must be valid UTF-8 encoded text. The return value will
37 // have a reference count of 1. 41 // have a reference count of 1.
38 PP_Var StringToPPVar(const std::string& str); 42 PP_Var StringToPPVar(const std::string& str);
39 43
40 // Returns the String corresponding to the PP_Var. This pointer has not been 44 // Returns the String corresponding to the PP_Var. This pointer has not been
41 // AddRef'd, so you should not call Release! Returns NULL if the PP_Var is not 45 // AddRef'd, so you should not call Release! Returns NULL if the PP_Var is not
42 // a string type. 46 // a string type.
43 String* GetString(PP_Var var); 47 String* GetString(PP_Var var);
44 48
49 // Instantiate this object on the stack to catch V8 exceptions and pass them
50 // to an optional out parameter supplied by the plugin.
51 class TryCatch {
52 public:
53 // The given exception may be NULL if the consumer isn't interested in
54 // catching exceptions. If non-NULL, the given var will be updated if any
55 // exception is thrown (so it must outlive the TryCatch object).
56 TryCatch(PP_Var* exception);
57 ~TryCatch();
58
59 // Returns true is an exception has been thrown. This can be true immediately
60 // after construction if the var passed to the constructor is non-void.
61 bool HasException() const;
62
63 // Sets the given exception.
64 void SetException(const char* message);
65
66 private:
67 static void Catch(void* self, const char* message);
68
69 // May be null if the consumer isn't interesting in catching exceptions.
70 PP_Var* exception_;
71 };
72
45 } // namespace pepper 73 } // namespace pepper
46 74
47 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_ 75 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_VAR_H_
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_plugin_instance.cc ('k') | webkit/glue/plugins/pepper_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698