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

Side by Side Diff: webkit/glue/cpp_bound_class.cc

Issue 10382059: Quote CppBoundClass/CppVariant in namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (C) 2012 Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 virtual bool SetValue(const CppVariant& value) { 56 virtual bool SetValue(const CppVariant& value) {
57 return false; 57 return false;
58 } 58 }
59 59
60 private: 60 private:
61 CppBoundClass::GetterCallback callback_; 61 CppBoundClass::GetterCallback callback_;
62 }; 62 };
63 63
64 } 64 }
65 65
66 namespace webkit_glue {
67
66 // Our special NPObject type. We extend an NPObject with a pointer to a 68 // Our special NPObject type. We extend an NPObject with a pointer to a
67 // CppBoundClass, which is just a C++ interface that we forward all NPObject 69 // CppBoundClass, which is just a C++ interface that we forward all NPObject
68 // callbacks to. 70 // callbacks to.
69 struct CppNPObject { 71 struct CppNPObject {
70 NPObject parent; // This must be the first field in the struct. 72 NPObject parent; // This must be the first field in the struct.
71 CppBoundClass* bound_class; 73 CppBoundClass* bound_class;
72 74
73 // 75 //
74 // All following objects and functions are static, and just used to interface 76 // All following objects and functions are static, and just used to interface
75 // with NPObject/NPClass. 77 // with NPObject/NPClass.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 JSC::JSLock lock(false); 319 JSC::JSLock lock(false);
318 #endif 320 #endif
319 321
320 // BindToWindowObject will take its own reference to the NPObject, and clean 322 // BindToWindowObject will take its own reference to the NPObject, and clean
321 // up after itself. It will also (indirectly) register the object with V8, 323 // up after itself. It will also (indirectly) register the object with V8,
322 // so we must remember this so we can unregister it when we're destroyed. 324 // so we must remember this so we can unregister it when we're destroyed.
323 frame->bindToWindowObject(ASCIIToUTF16(classname), 325 frame->bindToWindowObject(ASCIIToUTF16(classname),
324 NPVARIANT_TO_OBJECT(*GetAsCppVariant())); 326 NPVARIANT_TO_OBJECT(*GetAsCppVariant()));
325 bound_to_frame_ = true; 327 bound_to_frame_ = true;
326 } 328 }
329
330 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698