| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This file contains definitions for CppBoundClass | 5 // This file contains definitions for CppBoundClass |
| 6 | 6 |
| 7 // Here's the control flow of a JS method getting forwarded to a class. | 7 // Here's the control flow of a JS method getting forwarded to a class. |
| 8 // - Something calls our NPObject with a function like "Invoke". | 8 // - Something calls our NPObject with a function like "Invoke". |
| 9 // - CppNPObject's static invoke() function forwards it to its attached | 9 // - CppNPObject's static invoke() function forwards it to its attached |
| 10 // CppBoundClass's Invoke() method. | 10 // CppBoundClass's Invoke() method. |
| 11 // - CppBoundClass has then overridden Invoke() to look up the function | 11 // - CppBoundClass has then overridden Invoke() to look up the function |
| 12 // name in its internal map of methods, and then calls the appropriate | 12 // name in its internal map of methods, and then calls the appropriate |
| 13 // method. | 13 // method. |
| 14 | 14 |
| 15 #include "config.h" | 15 #include "config.h" |
| 16 | 16 |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/logging.h" |
| 18 | 19 |
| 19 #include "webkit/glue/cpp_bound_class.h" | 20 #include "webkit/glue/cpp_bound_class.h" |
| 20 #include "webkit/glue/webframe.h" | 21 #include "webkit/glue/webframe.h" |
| 21 | 22 |
| 22 // This is required for the KJS build due to an artifact of the | 23 // This is required for the KJS build due to an artifact of the |
| 23 // npruntime_priv.h file from JavaScriptCore/bindings. | 24 // npruntime_priv.h file from JavaScriptCore/bindings. |
| 24 MSVC_PUSH_DISABLE_WARNING(4067) | 25 MSVC_PUSH_DISABLE_WARNING(4067) |
| 25 #include "npruntime_priv.h" | 26 #include "npruntime_priv.h" |
| 26 MSVC_POP_WARNING() | 27 MSVC_POP_WARNING() |
| 27 | 28 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 #if USE(JSC) | 255 #if USE(JSC) |
| 255 JSC::JSLock lock(false); | 256 JSC::JSLock lock(false); |
| 256 #endif | 257 #endif |
| 257 | 258 |
| 258 // BindToWindowObject will take its own reference to the NPObject, and clean | 259 // BindToWindowObject will take its own reference to the NPObject, and clean |
| 259 // up after itself. It will also (indirectly) register the object with V8, | 260 // up after itself. It will also (indirectly) register the object with V8, |
| 260 // so we must remember this so we can unregister it when we're destroyed. | 261 // so we must remember this so we can unregister it when we're destroyed. |
| 261 frame->BindToWindowObject(classname, NPVARIANT_TO_OBJECT(*GetAsCppVariant())); | 262 frame->BindToWindowObject(classname, NPVARIANT_TO_OBJECT(*GetAsCppVariant())); |
| 262 bound_to_frame_ = true; | 263 bound_to_frame_ = true; |
| 263 } | 264 } |
| OLD | NEW |