OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // static v8::Handle<v8::Function> createFunction(ScriptState* scriptState) | 46 // static v8::Handle<v8::Function> createFunction(ScriptState* scriptState) |
47 // { | 47 // { |
48 // DerivedFunction* self = new DerivedFunction(scriptState); | 48 // DerivedFunction* self = new DerivedFunction(scriptState); |
49 // return self->bindToV8Function(); | 49 // return self->bindToV8Function(); |
50 // } | 50 // } |
51 // }; | 51 // }; |
52 class ScriptFunction : public GarbageCollectedFinalized<ScriptFunction> { | 52 class ScriptFunction : public GarbageCollectedFinalized<ScriptFunction> { |
53 public: | 53 public: |
54 virtual ~ScriptFunction() { } | 54 virtual ~ScriptFunction() { } |
55 ScriptState* scriptState() const { return m_scriptState.get(); } | 55 ScriptState* scriptState() const { return m_scriptState.get(); } |
56 virtual void trace(Visitor*) { } | 56 DEFINE_INLINE_VIRTUAL_TRACE() { } |
57 | 57 |
58 protected: | 58 protected: |
59 explicit ScriptFunction(ScriptState* scriptState) | 59 explicit ScriptFunction(ScriptState* scriptState) |
60 : m_scriptState(scriptState) | 60 : m_scriptState(scriptState) |
61 { | 61 { |
62 } | 62 } |
63 | 63 |
64 v8::Handle<v8::Function> bindToV8Function(); | 64 v8::Handle<v8::Function> bindToV8Function(); |
65 | 65 |
66 private: | 66 private: |
67 virtual ScriptValue call(ScriptValue) = 0; | 67 virtual ScriptValue call(ScriptValue) = 0; |
68 static void callCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 68 static void callCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
69 | 69 |
70 RefPtr<ScriptState> m_scriptState; | 70 RefPtr<ScriptState> m_scriptState; |
71 }; | 71 }; |
72 | 72 |
73 } // namespace blink | 73 } // namespace blink |
74 | 74 |
75 #endif | 75 #endif |
OLD | NEW |