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

Side by Side Diff: content/browser/renderer_host/java/java_method.h

Issue 8509019: Add JavaBoundObject (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved new files to java/ Created 9 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_METHOD_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_METHOD_H_
7
8 #include <jni.h>
9 #include <string>
10 #include <vector>
11
12 #include "base/android/scoped_java_ref.h"
13
14 struct JavaType {
15 enum Type {
16 TypeBoolean,
17 TypeByte,
18 TypeChar,
19 TypeShort,
20 TypeInt,
21 TypeLong,
22 TypeFloat,
23 TypeDouble,
24 // This is only used as a return type, so we should never convert from
25 // JavaScript with this type.
26 TypeVoid,
27 TypeArray,
28 // We special-case strings, as they get special handling when coercing.
29 TypeString,
30 TypeObject,
31 };
32 };
33
34 // A wrapper around java.lang.reflect.Method. This class is not threadsafe. It
35 // must be used on a single thread only.
36 class JavaMethod {
37 public:
38 explicit JavaMethod(const base::android::JavaRef<jobject>& method);
39
joth 2011/11/11 11:40:38 declare a d'tor and define it in the .cc
Steve Block 2011/11/11 12:22:53 Done.
40 std::string name() const;
41 size_t num_parameters() const;
42 JavaType::Type parameter_type(size_t index) const;
43 JavaType::Type return_type() const;
44 jmethodID id() const;
45
46 private:
47 void EnsureNumParametersIsSetUp();
48 void EnsureTypesAndIDAreSetUp();
49
50 std::string name_;
51 base::android::ScopedJavaGlobalRef<jobject> java_method_;
52 bool have_calculated_num_parameters_;
53 size_t num_parameters_;
54 std::vector<JavaType::Type> parameter_types_;
55 JavaType::Type return_type_;
56 jmethodID id_;
57
58 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaMethod);
59 };
60
61 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_METHOD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698