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

Side by Side Diff: bindings/v8/V8Proxy.h

Issue 151078: Speed up creation of DOM node wrappers (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « no previous file | bindings/v8/V8Proxy.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 public: 178 public:
179 // The types of javascript errors that can be thrown. 179 // The types of javascript errors that can be thrown.
180 enum ErrorType { 180 enum ErrorType {
181 RangeError, 181 RangeError,
182 ReferenceError, 182 ReferenceError,
183 SyntaxError, 183 SyntaxError,
184 TypeError, 184 TypeError,
185 GeneralError 185 GeneralError
186 }; 186 };
187 187
188 explicit V8Proxy(Frame* frame) : m_frame(frame), m_inlineCode(false), m_ timerCallback(false), m_recursion(0) { } 188 explicit V8Proxy(Frame* frame) : m_frame(frame), m_domNodeMap(getDOMNode Map()), m_inlineCode(false), m_timerCallback(false), m_recursion(0) { }
189 189
190 ~V8Proxy(); 190 ~V8Proxy();
191 191
192 Frame* frame() { return m_frame; } 192 Frame* frame() { return m_frame; }
193 193
194 // Clear page-specific data, but keep the global object identify. 194 // Clear page-specific data, but keep the global object identify.
195 void clearForNavigation(); 195 void clearForNavigation();
196 196
197 // Clear page-specific data before shutting down the proxy object. 197 // Clear page-specific data before shutting down the proxy object.
198 void clearForClose(); 198 void clearForClose();
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 static void setHiddenWindowReference(Frame*, const int internalIndex, v8 ::Handle<v8::Object>); 549 static void setHiddenWindowReference(Frame*, const int internalIndex, v8 ::Handle<v8::Object>);
550 550
551 static V8ClassIndex::V8WrapperType htmlElementType(HTMLElement*); 551 static V8ClassIndex::V8WrapperType htmlElementType(HTMLElement*);
552 552
553 // The first V8WrapperType specifies the function descriptor 553 // The first V8WrapperType specifies the function descriptor
554 // used to create JS object. The second V8WrapperType specifies 554 // used to create JS object. The second V8WrapperType specifies
555 // the actual type of the void* for type casting. 555 // the actual type of the void* for type casting.
556 // For example, a HTML element has HTMLELEMENT for the first V8WrapperTy pe, but always 556 // For example, a HTML element has HTMLELEMENT for the first V8WrapperTy pe, but always
557 // use NODE as the second V8WrapperType. JS wrapper stores the second 557 // use NODE as the second V8WrapperType. JS wrapper stores the second
558 // V8WrapperType and the void* as internal fields. 558 // V8WrapperType and the void* as internal fields.
559 static v8::Local<v8::Object> instantiateV8Object(V8ClassIndex::V8Wrapper Type, V8ClassIndex::V8WrapperType, void*); 559 static v8::Local<v8::Object> instantiateV8Object(V8ClassIndex::V8Wrapper Type descType, V8ClassIndex::V8WrapperType cptrType, void* impl)
560 {
561 return instantiateV8Object(NULL, descType, cptrType, impl);
562 }
563
564 static v8::Local<v8::Object> instantiateV8Object(V8Proxy*, V8ClassIndex: :V8WrapperType, V8ClassIndex::V8WrapperType, void*);
565
560 566
561 static const char* rangeExceptionName(int exceptionCode); 567 static const char* rangeExceptionName(int exceptionCode);
562 static const char* eventExceptionName(int exceptionCode); 568 static const char* eventExceptionName(int exceptionCode);
563 static const char* xmlHttpRequestExceptionName(int exceptionCode); 569 static const char* xmlHttpRequestExceptionName(int exceptionCode);
564 static const char* domExceptionName(int exceptionCode); 570 static const char* domExceptionName(int exceptionCode);
565 571
566 #if ENABLE(XPATH) 572 #if ENABLE(XPATH)
567 static const char* xpathExceptionName(int exceptionCode); 573 static const char* xpathExceptionName(int exceptionCode);
568 #endif 574 #endif
569 575
(...skipping 18 matching lines...) Expand all
588 // For each possible type of wrapper, we keep a boilerplate object. 594 // For each possible type of wrapper, we keep a boilerplate object.
589 // The boilerplate is used to create additional wrappers of the same typ e. 595 // The boilerplate is used to create additional wrappers of the same typ e.
590 // We keep a single persistent handle to an array of the activated 596 // We keep a single persistent handle to an array of the activated
591 // boilerplates. 597 // boilerplates.
592 v8::Persistent<v8::Array> m_wrapperBoilerplates; 598 v8::Persistent<v8::Array> m_wrapperBoilerplates;
593 v8::Persistent<v8::Value> m_objectPrototype; 599 v8::Persistent<v8::Value> m_objectPrototype;
594 600
595 v8::Persistent<v8::Object> m_global; 601 v8::Persistent<v8::Object> m_global;
596 v8::Persistent<v8::Value> m_document; 602 v8::Persistent<v8::Value> m_document;
597 603
604 DOMWrapperMap<Node>& m_domNodeMap;
605
598 // Utility context holding JavaScript functions used internally. 606 // Utility context holding JavaScript functions used internally.
599 static v8::Persistent<v8::Context> m_utilityContext; 607 static v8::Persistent<v8::Context> m_utilityContext;
600 608
601 int m_handlerLineNumber; 609 int m_handlerLineNumber;
602 610
603 // A list of event listeners created for this frame, 611 // A list of event listeners created for this frame,
604 // the list gets cleared when removing all timeouts. 612 // the list gets cleared when removing all timeouts.
605 V8EventListenerList m_eventListeners; 613 V8EventListenerList m_eventListeners;
606 614
607 // A list of event listeners create for XMLHttpRequest object for this f rame, 615 // A list of event listeners create for XMLHttpRequest object for this f rame,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 template <class T> inline v8::Handle<v8::Object> toV8(PassRefPtr<T> object, v8::Local<v8::Object> holder) 681 template <class T> inline v8::Handle<v8::Object> toV8(PassRefPtr<T> object, v8::Local<v8::Object> holder)
674 { 682 {
675 object->ref(); 683 object->ref();
676 V8Proxy::setJSWrapperForDOMObject(object.get(), v8::Persistent<v8::Objec t>::New(holder)); 684 V8Proxy::setJSWrapperForDOMObject(object.get(), v8::Persistent<v8::Objec t>::New(holder));
677 return holder; 685 return holder;
678 } 686 }
679 687
680 } 688 }
681 689
682 #endif // V8Proxy_h 690 #endif // V8Proxy_h
OLDNEW
« no previous file with comments | « no previous file | bindings/v8/V8Proxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698