| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // class DerivedFunction : public ScriptFunction { | 42 // class DerivedFunction : public ScriptFunction { |
| 43 // // This returns a V8 function which the DerivedFunction is bound to. | 43 // // This returns a V8 function which the DerivedFunction is bound to. |
| 44 // // The DerivedFunction is destructed when the V8 function is | 44 // // The DerivedFunction is destructed when the V8 function is |
| 45 // // garbage-collected. | 45 // // garbage-collected. |
| 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 { |
| 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*) { } | |
| 57 | 56 |
| 58 protected: | 57 protected: |
| 59 explicit ScriptFunction(ScriptState* scriptState) | 58 explicit ScriptFunction(ScriptState* scriptState) |
| 60 : m_scriptState(scriptState) | 59 : m_scriptState(scriptState) |
| 61 { | 60 { |
| 62 } | 61 } |
| 63 | 62 |
| 64 v8::Handle<v8::Function> bindToV8Function(); | 63 v8::Handle<v8::Function> bindToV8Function(); |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 virtual ScriptValue call(ScriptValue) = 0; | 66 virtual ScriptValue call(ScriptValue) = 0; |
| 68 static void callCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 67 static void callCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 69 | 68 |
| 70 RefPtr<ScriptState> m_scriptState; | 69 RefPtr<ScriptState> m_scriptState; |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 } // namespace blink | 72 } // namespace blink |
| 74 | 73 |
| 75 #endif | 74 #endif |
| OLD | NEW |