Permalink
Browse files

[Object] Switch over to shared_ptr based implementation

We're going to manage interface objects by using std::shared_ptr and replacing
the internal reference counting method. This change is the first big one for
doing this. We will check and fix circular references, etc., by smaller changes
later.

1) Base classes

With this change, implementation objects that are derived from the Imp class
are managed by std::shared_ptr.

org/w3c/dom/ObjectArray.h
src/Any.cpp
src/Any.h
src/Any.test.cpp
src/Object.h
src/ObjectArrayImp.h

(Imp) : Every interface implementation class is now derived from this class
(Object) : The new Object class is basically a wrapper for std::shared_ptr<Imp>
(Any, ObjectArray, ObjectArrayImp) : Revised to support the new Object class

2) DOM, Window and Media

Refine details to support the new Object class.

src/BackgroundTask.cpp
src/MediaListImp.cpp
src/MediaListImp.h
src/NodeImp.cpp
src/NodeImp.h
src/WindowImp.cpp
src/WindowImp.h
src/WindowProxy.cpp
src/WindowProxy.h
src/html/HTMLIFrameElementImp.cpp
src/html/HTMLIFrameElementImp.h
src/html/MediaQueryListImp.cpp
src/html/MediaQueryListImp.h

3) JS and V8

Refine details to support the new Object class. Now that we cannot directly
manipulate the reference count of each interface object, an extra object, an
shared_ptr, is created for each corresponding ECMAScript object for keeping
them alive.

src/ECMAScript.h
src/js/Script.cpp
src/js/Script.h
src/js/bridge.cpp
src/js/esjsapi.h
src/v8/ScriptV8.cpp
src/v8/ScriptV8.h
src/v8/bridgeV8.cpp
src/v8/esv8api.h

4) CSS

Now CSSParser does not directly touch raw pointers of interface implementation
classes.

src/css/CSSGrammar.yy
src/css/CSSParser.cpp
src/css/CSSParser.h

CSS property values are accessed via the CSSStyleDeclarationImp class using a
double dispatch like method, and thus we use the raw CSSStyleDeclarationImp
pointer rather than CSSStyleDeclarationPtr. This is intentional and the
corresponding parameters are named 'self'.

src/css/CSSPropertyValueImp.cpp
src/css/CSSPropertyValueImp.h

CSSStyleDeclarationImp::pseudoElements[0] does no longer contain a pointer to
itself as it will end up a circular reference. Otherwise, changes are trivial.

src/css/CSSStyleDeclarationImp.cpp
src/css/CSSStyleDeclarationImp.h

The box classes are still manged by using the internal reference counting,
but not using the former Object methods this time. We will modify these using
std::shared_ptr later, too.

src/css/Box.cpp
src/css/Box.h
src/css/BoxGL.cpp

5) cloneNode operations and copy constructors

Since self(), i.e., shared_from_this(), cannot be used inside the constructors,
every cloneNode operation is revised. The changes are very straightforward.

src/CharacterDataImp.h
src/ElementImp.cpp
src/ElementImp.h
src/TextImp.cpp
src/TextImp.h
src/html/HTMLAnchorElementImp.cpp
src/html/HTMLAnchorElementImp.h
src/html/HTMLAppletElementImp.h
src/html/HTMLAreaElementImp.cpp
src/html/HTMLAreaElementImp.h
src/html/HTMLAudioElementImp.h
src/html/HTMLBRElementImp.cpp
src/html/HTMLBRElementImp.h
src/html/HTMLBaseElementImp.cpp
src/html/HTMLBaseElementImp.h
src/html/HTMLBindingElementImp.cpp
src/html/HTMLBindingElementImp.h
src/html/HTMLBodyElementImp.cpp
src/html/HTMLBodyElementImp.h
src/html/HTMLButtonElementImp.h
src/html/HTMLCanvasElementImp.cpp
src/html/HTMLCanvasElementImp.h
src/html/HTMLCommandElementImp.cpp
src/html/HTMLCommandElementImp.h
src/html/HTMLDListElementImp.h
src/html/HTMLDataListElementImp.cpp
src/html/HTMLDataListElementImp.h
src/html/HTMLDetailsElementImp.h
src/html/HTMLDivElementImp.cpp
src/html/HTMLDivElementImp.h
src/html/HTMLElementImp.cpp
src/html/HTMLElementImp.h
src/html/HTMLEmbedElementImp.h
src/html/HTMLFieldSetElementImp.cpp
src/html/HTMLFieldSetElementImp.h
src/html/HTMLFontElementImp.h
src/html/HTMLFormElementImp.cpp
src/html/HTMLFormElementImp.h
src/html/HTMLFrameElementImp.cpp
src/html/HTMLHRElementImp.h
src/html/HTMLHeadElementImp.cpp
src/html/HTMLHeadElementImp.h
src/html/HTMLHeadingElementImp.h
src/html/HTMLHtmlElementImp.cpp
src/html/HTMLHtmlElementImp.h
src/html/HTMLImageElementImp.cpp
src/html/HTMLImageElementImp.h
src/html/HTMLInputElementImp.cpp
src/html/HTMLInputElementImp.h
src/html/HTMLKeygenElementImp.cpp
src/html/HTMLKeygenElementImp.h
src/html/HTMLLIElementImp.h
src/html/HTMLLabelElementImp.cpp
src/html/HTMLLabelElementImp.h
src/html/HTMLLegendElementImp.cpp
src/html/HTMLLegendElementImp.h
src/html/HTMLLinkElementImp.cpp
src/html/HTMLLinkElementImp.h
src/html/HTMLMapElementImp.cpp
src/html/HTMLMapElementImp.h
src/html/HTMLMarqueeElementImp.cpp
src/html/HTMLMarqueeElementImp.h
src/html/HTMLMediaElementImp.cpp
src/html/HTMLMediaElementImp.h
src/html/HTMLMenuElementImp.h
src/html/HTMLMetaElementImp.cpp
src/html/HTMLMetaElementImp.h
src/html/HTMLMeterElementImp.cpp
src/html/HTMLMeterElementImp.h
src/html/HTMLModElementImp.h
src/html/HTMLOListElementImp.cpp
src/html/HTMLOListElementImp.h
src/html/HTMLObjectElementImp.cpp
src/html/HTMLObjectElementImp.h
src/html/HTMLOptGroupElementImp.h
src/html/HTMLOptionElementImp.cpp
src/html/HTMLOptionElementImp.h
src/html/HTMLOutputElementImp.cpp
src/html/HTMLOutputElementImp.h
src/html/HTMLParagraphElementImp.h
src/html/HTMLParamElementImp.h
src/html/HTMLPreElementImp.h
src/html/HTMLProgressElementImp.cpp
src/html/HTMLProgressElementImp.h
src/html/HTMLQuoteElementImp.h
src/html/HTMLReplacedElementImp.h
src/html/HTMLScriptElementImp.cpp
src/html/HTMLScriptElementImp.h
src/html/HTMLSelectElementImp.cpp
src/html/HTMLSelectElementImp.h
src/html/HTMLSourceElementImp.h
src/html/HTMLSpanElementImp.cpp
src/html/HTMLSpanElementImp.h
src/html/HTMLStyleElementImp.cpp
src/html/HTMLStyleElementImp.h
src/html/HTMLTableCaptionElementImp.h
src/html/HTMLTableCellElementImp.cpp
src/html/HTMLTableCellElementImp.h
src/html/HTMLTableColElementImp.h
src/html/HTMLTableDataCellElementImp.h
src/html/HTMLTableElementImp.cpp
src/html/HTMLTableElementImp.h
src/html/HTMLTableHeaderCellElementImp.h
src/html/HTMLTableRowElementImp.cpp
src/html/HTMLTableRowElementImp.h
src/html/HTMLTableSectionElementImp.cpp
src/html/HTMLTableSectionElementImp.h
src/html/HTMLTemplateElementImp.cpp
src/html/HTMLTemplateElementImp.h
src/html/HTMLTextAreaElementImp.cpp
src/html/HTMLTextAreaElementImp.h
src/html/HTMLTimeElementImp.h
src/html/HTMLTitleElementImp.cpp
src/html/HTMLTitleElementImp.h
src/html/HTMLTrackElementImp.cpp
src/html/HTMLUListElementImp.h
src/html/HTMLUnknownElementImp.cpp
src/html/HTMLUnknownElementImp.h
src/html/HTMLVideoElementImp.h

6) Trivial changes

Trivial changes such as:
  Add typedefs for shread_ptr<T>
  Prefer nullptr to 0 where appropriate
  Use std::make_shared instead of new
  Use std::dynamic_pointer_cast instead of dynamic_cast
and so on.

src/AttrImp.h
src/Box.test.cpp
src/CaretPositionImp.cpp
src/CharacterDataImp.cpp
src/ClientRectListImp.cpp
src/CSSStyle.test.cpp
src/DocumentFragmentImp.cpp
src/DocumentImp.cpp
src/DocumentImp.h
src/DocumentTypeImp.cpp
src/DocumentTypeImp.h
src/DOMImplementationImp.cpp
src/DOMImplementationImp.h
src/DOMParserImp.cpp
src/DOMTokenListImp.h
src/DragEventImp.cpp
src/DragEventInitImp.cpp
src/Escudo.cpp
src/EventImp.cpp
src/EventImp.h
src/EventListenerImp.h
src/EventSourceImp.cpp
src/EventTargetImp.cpp
src/EventTargetImp.h
src/FocusEventImp.cpp
src/HistoryImp.cpp
src/HistoryImp.h
src/HTMLParser.test.cpp
src/KeyboardEventInitImp.cpp
src/LocationImp.cpp
src/LocationImp.h
src/MessageEventImp.cpp
src/MessageEventInitImp.cpp
src/MouseEventImp.h
src/MouseEventInitImp.cpp
src/MutationEventImp.h
src/MutationRecordImp.cpp
src/Navigator.test.cpp
src/NodeIteratorImp.cpp
src/NodeListImp.h
src/ProcessingInstructionImp.cpp
src/RangeImp.cpp
src/Script.test.cpp
src/StyleSheetImp.cpp
src/Test.glut.cpp
src/Test.util.cpp
src/TrackEventImp.cpp
src/TrackEventInitImp.cpp
src/TreeWalkerImp.cpp
src/UIEventImp.h
src/UIEventInitImp.cpp
src/WheelEventInitImp.cpp
src/css/CSSCharsetRuleImp.cpp
src/css/CSSFontFaceRuleImp.cpp
src/css/CSSImportRuleImp.cpp
src/css/CSSImportRuleImp.h
src/css/CSSMediaRuleImp.cpp
src/css/CSSMediaRuleImp.h
src/css/CSSNamespaceRuleImp.cpp
src/css/CSSPageRuleImp.cpp
src/css/CSSPrimitiveValueImp.cpp
src/css/CSSRuleImp.cpp
src/css/CSSRuleImp.h
src/css/CSSRuleListImp.cpp
src/css/CSSRuleListImp.h
src/css/CSSSelector.cpp
src/css/CSSSelector.h
src/css/CSSStyleRuleImp.cpp
src/css/CSSStyleRuleImp.h
src/css/CSSStyleSheetImp.cpp
src/css/CSSStyleSheetImp.h
src/css/CSSUnknownRuleImp.cpp
src/css/CSSValueListImp.cpp
src/css/CounterImp.h
src/css/DocumentCSSImp.cpp
src/css/FormattingContext.cpp
src/css/FormattingContext.h
src/css/LineBox.cpp
src/css/RGBColorImp.cpp
src/css/RectImp.cpp
src/css/Replaced.cpp
src/css/StackingContext.cpp
src/css/StackingContext.h
src/css/Table.cpp
src/css/Table.h
src/css/TableGL.cpp
src/css/ViewCSSImp.cpp
src/css/ViewCSSImp.h
src/css/ViewCSSImpGL.cpp
src/file/BlobImp.cpp
src/file/FileListImp.cpp
src/file/FileReaderImp.cpp
src/file/FileReaderSyncImp.cpp
src/html/ApplicationCacheImp.cpp
src/html/AudioTrackListImp.cpp
src/html/CanvasRenderingContext2DImp.cpp
src/html/DataTransferImp.cpp
src/html/DataTransferItemImp.cpp
src/html/DataTransferItemListImp.cpp
src/html/HitRegionOptionsImp.cpp
src/html/HTMLAllCollectionImp.cpp
src/html/HTMLCollectionImp.cpp
src/html/HTMLCollectionImp.h
src/html/HTMLFormControlImp.cpp
src/html/HTMLFormControlImp.h
src/html/HTMLFormControlsCollectionImp.cpp
src/html/HTMLFormControlsCollectionImp.h
src/html/HTMLOptionsCollectionImp.cpp
src/html/HTMLParser.cpp
src/html/HTMLParser.h
src/html/HTMLPropertiesCollectionImp.cpp
src/html/HTMLTokenizer.cpp
src/html/HTMLTokenizer.h
src/html/ImageDataImp.cpp
src/html/MediaControllerImp.cpp
src/html/MessageChannelImp.cpp
src/html/MessagePortImp.cpp
src/html/RadioNodeListImp.cpp
src/html/ScreenImp.h
src/html/TextTrackCueImp.cpp
src/html/TextTrackCueListImp.cpp
src/html/TextTrackImp.cpp
src/html/TextTrackListImp.cpp
src/html/VideoTrackListImp.cpp
src/http/HTTPRequest.h
src/svg/SVGMatrixImp.cpp
src/typedarray/ArrayBufferImp.cpp
src/typedarray/ArrayBufferViewImp.cpp
src/typedarray/DataViewImp.cpp
src/typedarray/Float32ArrayImp.cpp
src/typedarray/Float64ArrayImp.cpp
src/typedarray/Int16ArrayImp.cpp
src/typedarray/Int32ArrayImp.cpp
src/typedarray/Int8ArrayImp.cpp
src/typedarray/Uint16ArrayImp.cpp
src/typedarray/Uint32ArrayImp.cpp
src/typedarray/Uint8ArrayImp.cpp
src/typedarray/Uint8ClampedArrayImp.cpp
src/xhr/XMLHttpRequestEventTargetImp.cpp
src/xhr/XMLHttpRequestImp.cpp
src/xbl/XBLContentElementImp.cpp
src/xbl/XBLImplementationListImp.cpp
  • Loading branch information...
ShikiOkasaka committed Sep 21, 2013
1 parent 7b02da0 commit 0c895cbe1d325d33a5e5b6d16a1bfc6f8b480bd7
Showing with 4,057 additions and 3,561 deletions.
  1. +15 −11 org/w3c/dom/ObjectArray.h
  2. +4 −5 src/Any.cpp
  3. +2 −2 src/Any.h
  4. +15 −6 src/Any.test.cpp
  5. +10 −5 src/AttrImp.h
  6. +55 −49 src/BackgroundTask.cpp
  7. +4 −4 src/Box.test.cpp
  8. +4 −4 src/CSSStyle.test.cpp
  9. +1 −1 src/CaretPositionImp.cpp
  10. +3 −3 src/CharacterDataImp.cpp
  11. +9 −4 src/CharacterDataImp.h
  12. +1 −1 src/ClientRectListImp.cpp
  13. +13 −20 src/DOMImplementationImp.cpp
  14. +11 −7 src/DOMImplementationImp.h
  15. +1 −1 src/DOMParserImp.cpp
  16. +2 −2 src/DOMTokenListImp.h
  17. +2 −2 src/DocumentFragmentImp.cpp
  18. +182 −169 src/DocumentImp.cpp
  19. +35 −40 src/DocumentImp.h
  20. +3 −3 src/DocumentTypeImp.cpp
  21. +2 −2 src/DocumentTypeImp.h
  22. +1 −1 src/DragEventImp.cpp
  23. +3 −3 src/DragEventInitImp.cpp
  24. +2 −2 src/ECMAScript.h
  25. +82 −108 src/ElementImp.cpp
  26. +18 −7 src/ElementImp.h
  27. +2 −2 src/Escudo.cpp
  28. +5 −11 src/EventImp.cpp
  29. +2 −0 src/EventImp.h
  30. +2 −0 src/EventListenerImp.h
  31. +3 −3 src/EventSourceImp.cpp
  32. +29 −27 src/EventTargetImp.cpp
  33. +8 −3 src/EventTargetImp.h
  34. +1 −1 src/FocusEventImp.cpp
  35. +3 −2 src/HTMLParser.test.cpp
  36. +25 −3 src/HistoryImp.cpp
  37. +3 −15 src/HistoryImp.h
  38. +1 −1 src/KeyboardEventInitImp.cpp
  39. +2 −8 src/LocationImp.cpp
  40. +5 −4 src/LocationImp.h
  41. +16 −8 src/MediaListImp.cpp
  42. +5 −1 src/MediaListImp.h
  43. +2 −2 src/MessageEventImp.cpp
  44. +2 −2 src/MessageEventInitImp.cpp
  45. +0 −5 src/MouseEventImp.h
  46. +2 −2 src/MouseEventInitImp.cpp
  47. +1 −2 src/MutationEventImp.h
  48. +5 −5 src/MutationRecordImp.cpp
  49. +2 −2 src/Navigator.test.cpp
  50. +122 −152 src/NodeImp.cpp
  51. +37 −20 src/NodeImp.h
  52. +5 −5 src/NodeIteratorImp.cpp
  53. +4 −2 src/NodeListImp.h
  54. +97 −99 src/Object.h
  55. +14 −11 src/ObjectArrayImp.h
  56. +3 −3 src/ProcessingInstructionImp.cpp
  57. +9 −9 src/RangeImp.cpp
  58. +2 −2 src/Script.test.cpp
  59. +1 −3 src/StyleSheetImp.cpp
  60. +11 −11 src/Test.glut.cpp
  61. +2 −2 src/Test.util.cpp
  62. +1 −1 src/TextImp.cpp
  63. +5 −4 src/TextImp.h
  64. +1 −1 src/TrackEventImp.cpp
  65. +1 −1 src/TrackEventInitImp.cpp
  66. +10 −10 src/TreeWalkerImp.cpp
  67. +2 −6 src/UIEventImp.h
  68. +1 −1 src/UIEventInitImp.cpp
  69. +2 −2 src/WheelEventInitImp.cpp
  70. +38 −42 src/WindowImp.cpp
  71. +10 −9 src/WindowImp.h
  72. +149 −148 src/WindowProxy.cpp
  73. +30 −17 src/WindowProxy.h
  74. +17 −18 src/css/Box.cpp
  75. +49 −22 src/css/Box.h
  76. +7 −7 src/css/BoxGL.cpp
  77. +16 −4 src/css/CSSCharsetRuleImp.cpp
  78. +17 −5 src/css/CSSFontFaceRuleImp.cpp
  79. +72 −73 src/css/CSSGrammar.yy
  80. +19 −15 src/css/CSSImportRuleImp.cpp
  81. +7 −3 src/css/CSSImportRuleImp.h
  82. +14 −15 src/css/CSSMediaRuleImp.cpp
  83. +3 −1 src/css/CSSMediaRuleImp.h
  84. +16 −4 src/css/CSSNamespaceRuleImp.cpp
  85. +17 −5 src/css/CSSPageRuleImp.cpp
  86. +6 −6 src/css/CSSParser.cpp
  87. +44 −21 src/css/CSSParser.h
  88. +3 −3 src/css/CSSPrimitiveValueImp.cpp
  89. +350 −349 src/css/CSSPropertyValueImp.cpp
  90. +117 −115 src/css/CSSPropertyValueImp.h
  91. +5 −12 src/css/CSSRuleImp.cpp
  92. +14 −9 src/css/CSSRuleImp.h
  93. +28 −28 src/css/CSSRuleListImp.cpp
  94. +16 −15 src/css/CSSRuleListImp.h
  95. +3 −3 src/css/CSSSelector.cpp
  96. +2 −2 src/css/CSSSelector.h
  97. +96 −104 src/css/CSSStyleDeclarationImp.cpp
  98. +45 −36 src/css/CSSStyleDeclarationImp.h
  99. +13 −6 src/css/CSSStyleRuleImp.cpp
  100. +11 −4 src/css/CSSStyleRuleImp.h
  101. +8 −8 src/css/CSSStyleSheetImp.cpp
  102. +4 −1 src/css/CSSStyleSheetImp.h
  103. +16 −4 src/css/CSSUnknownRuleImp.cpp
  104. +1 −1 src/css/CSSValueListImp.cpp
  105. +2 −3 src/css/CounterImp.h
  106. +1 −1 src/css/DocumentCSSImp.cpp
  107. +3 −3 src/css/FormattingContext.cpp
  108. +1 −3 src/css/FormattingContext.h
  109. +35 −34 src/css/LineBox.cpp
  110. +3 −3 src/css/RGBColorImp.cpp
  111. +4 −4 src/css/RectImp.cpp
  112. +3 −3 src/css/Replaced.cpp
  113. +15 −10 src/css/StackingContext.cpp
  114. +10 −8 src/css/StackingContext.h
  115. +56 −58 src/css/Table.cpp
  116. +9 −9 src/css/Table.h
  117. +11 −11 src/css/TableGL.cpp
  118. +88 −86 src/css/ViewCSSImp.cpp
  119. +21 −19 src/css/ViewCSSImp.h
  120. +6 −5 src/css/ViewCSSImpGL.cpp
  121. +4 −4 src/file/BlobImp.cpp
  122. +1 −1 src/file/FileListImp.cpp
  123. +7 −7 src/file/FileReaderImp.cpp
  124. +1 −1 src/file/FileReaderSyncImp.cpp
  125. +8 −8 src/html/ApplicationCacheImp.cpp
  126. +5 −5 src/html/AudioTrackListImp.cpp
  127. +8 −8 src/html/CanvasRenderingContext2DImp.cpp
  128. +3 −3 src/html/DataTransferImp.cpp
  129. +1 −1 src/html/DataTransferItemImp.cpp
  130. +3 −3 src/html/DataTransferItemListImp.cpp
  131. +2 −2 src/html/HTMLAllCollectionImp.cpp
  132. +10 −10 src/html/HTMLAnchorElementImp.cpp
  133. +9 −1 src/html/HTMLAnchorElementImp.h
  134. +8 −3 src/html/HTMLAppletElementImp.h
  135. +1 −1 src/html/HTMLAreaElementImp.cpp
  136. +10 −4 src/html/HTMLAreaElementImp.h
  137. +9 −3 src/html/HTMLAudioElementImp.h
  138. +1 −7 src/html/HTMLBRElementImp.cpp
  139. +11 −8 src/html/HTMLBRElementImp.h
  140. +1 −7 src/html/HTMLBaseElementImp.cpp
  141. +12 −9 src/html/HTMLBaseElementImp.h
  142. +4 −4 src/html/HTMLBindingElementImp.cpp
  143. +4 −4 src/html/HTMLBindingElementImp.h
  144. +18 −23 src/html/HTMLBodyElementImp.cpp
  145. +7 −4 src/html/HTMLBodyElementImp.h
  146. +8 −3 src/html/HTMLButtonElementImp.h
  147. +1 −1 src/html/HTMLCanvasElementImp.cpp
  148. +9 −3 src/html/HTMLCanvasElementImp.h
  149. +4 −4 src/html/HTMLCollectionImp.cpp
  150. +4 −1 src/html/HTMLCollectionImp.h
  151. +1 −7 src/html/HTMLCommandElementImp.cpp
  152. +12 −9 src/html/HTMLCommandElementImp.h
  153. +14 −7 src/html/HTMLDListElementImp.h
  154. +1 −1 src/html/HTMLDataListElementImp.cpp
  155. +13 −8 src/html/HTMLDataListElementImp.h
  156. +14 −7 src/html/HTMLDetailsElementImp.h
  157. +2 −2 src/html/HTMLDivElementImp.cpp
  158. +8 −4 src/html/HTMLDivElementImp.h
  159. +104 −116 src/html/HTMLElementImp.cpp
  160. +17 −12 src/html/HTMLElementImp.h
  161. +8 −4 src/html/HTMLEmbedElementImp.h
  162. +3 −3 src/html/HTMLFieldSetElementImp.cpp
  163. +14 −7 src/html/HTMLFieldSetElementImp.h
  164. +9 −4 src/html/HTMLFontElementImp.h
  165. +3 −3 src/html/HTMLFormControlImp.cpp
  166. +8 −4 src/html/HTMLFormControlImp.h
  167. +10 −11 src/html/HTMLFormControlsCollectionImp.cpp
  168. +3 −2 src/html/HTMLFormControlsCollectionImp.h
  169. +18 −18 src/html/HTMLFormElementImp.cpp
  170. +16 −10 src/html/HTMLFormElementImp.h
  171. +2 −2 src/html/HTMLFrameElementImp.cpp
  172. +13 −6 src/html/HTMLHRElementImp.h
  173. +1 −7 src/html/HTMLHeadElementImp.cpp
  174. +11 −9 src/html/HTMLHeadElementImp.h
  175. +13 −7 src/html/HTMLHeadingElementImp.h
  176. +1 −7 src/html/HTMLHtmlElementImp.cpp
  177. +12 −9 src/html/HTMLHtmlElementImp.h
  178. +29 −23 src/html/HTMLIFrameElementImp.cpp
  179. +13 −2 src/html/HTMLIFrameElementImp.h
  180. +7 −18 src/html/HTMLImageElementImp.cpp
  181. +9 −2 src/html/HTMLImageElementImp.h
  182. +31 −33 src/html/HTMLInputElementImp.cpp
  183. +11 −3 src/html/HTMLInputElementImp.h
  184. +3 −3 src/html/HTMLKeygenElementImp.cpp
  185. +14 −7 src/html/HTMLKeygenElementImp.h
  186. +14 −7 src/html/HTMLLIElementImp.h
  187. +2 −2 src/html/HTMLLabelElementImp.cpp
  188. +14 −7 src/html/HTMLLabelElementImp.h
  189. +1 −1 src/html/HTMLLegendElementImp.cpp
  190. +14 −7 src/html/HTMLLegendElementImp.h
  191. +21 −29 src/html/HTMLLinkElementImp.cpp
  192. +10 −5 src/html/HTMLLinkElementImp.h
  193. +2 −2 src/html/HTMLMapElementImp.cpp
  194. +14 −7 src/html/HTMLMapElementImp.h
  195. +4 −8 src/html/HTMLMarqueeElementImp.cpp
  196. +8 −1 src/html/HTMLMarqueeElementImp.h
  197. +11 −11 src/html/HTMLMediaElementImp.cpp
  198. +9 −3 src/html/HTMLMediaElementImp.h
  199. +14 −7 src/html/HTMLMenuElementImp.h
  200. +1 −7 src/html/HTMLMetaElementImp.cpp
  201. +12 −9 src/html/HTMLMetaElementImp.h
  202. +1 −1 src/html/HTMLMeterElementImp.cpp
  203. +14 −7 src/html/HTMLMeterElementImp.h
  204. +14 −7 src/html/HTMLModElementImp.h
  205. +8 −8 src/html/HTMLOListElementImp.cpp
  206. +9 −1 src/html/HTMLOListElementImp.h
  207. +12 −11 src/html/HTMLObjectElementImp.cpp
  208. +9 −1 src/html/HTMLObjectElementImp.h
  209. +14 −7 src/html/HTMLOptGroupElementImp.h
  210. +1 −1 src/html/HTMLOptionElementImp.cpp
  211. +13 −6 src/html/HTMLOptionElementImp.h
  212. +1 −1 src/html/HTMLOptionsCollectionImp.cpp
  213. +4 −4 src/html/HTMLOutputElementImp.cpp
  214. +14 −7 src/html/HTMLOutputElementImp.h
  215. +14 −7 src/html/HTMLParagraphElementImp.h
  216. +14 −7 src/html/HTMLParamElementImp.h
  217. +53 −55 src/html/HTMLParser.cpp
  218. +12 −8 src/html/HTMLParser.h
  219. +8 −4 src/html/HTMLPreElementImp.h
  220. +1 −1 src/html/HTMLProgressElementImp.cpp
  221. +13 −7 src/html/HTMLProgressElementImp.h
  222. +2 −2 src/html/HTMLPropertiesCollectionImp.cpp
  223. +14 −7 src/html/HTMLQuoteElementImp.h
  224. +12 −4 src/html/HTMLReplacedElementImp.h
  225. +14 −20 src/html/HTMLScriptElementImp.cpp
  226. +10 −3 src/html/HTMLScriptElementImp.h
  227. +7 −7 src/html/HTMLSelectElementImp.cpp
  228. +9 −3 src/html/HTMLSelectElementImp.h
  229. +14 −7 src/html/HTMLSourceElementImp.h
  230. +1 −7 src/html/HTMLSpanElementImp.cpp
  231. +12 −9 src/html/HTMLSpanElementImp.h
  232. +21 −28 src/html/HTMLStyleElementImp.cpp
  233. +8 −3 src/html/HTMLStyleElementImp.h
  234. +14 −7 src/html/HTMLTableCaptionElementImp.h
  235. +1 −1 src/html/HTMLTableCellElementImp.cpp
  236. +9 −4 src/html/HTMLTableCellElementImp.h
  237. +8 −3 src/html/HTMLTableColElementImp.h
  238. +14 −7 src/html/HTMLTableDataCellElementImp.h
  239. +23 −23 src/html/HTMLTableElementImp.cpp
  240. +12 −8 src/html/HTMLTableElementImp.h
  241. +13 −6 src/html/HTMLTableHeaderCellElementImp.h
  242. +10 −10 src/html/HTMLTableRowElementImp.cpp
  243. +12 −8 src/html/HTMLTableRowElementImp.h
  244. +3 −3 src/html/HTMLTableSectionElementImp.cpp
  245. +13 −6 src/html/HTMLTableSectionElementImp.h
  246. +1 −1 src/html/HTMLTemplateElementImp.cpp
  247. +5 −8 src/html/HTMLTemplateElementImp.h
  248. +3 −3 src/html/HTMLTextAreaElementImp.cpp
  249. +9 −3 src/html/HTMLTextAreaElementImp.h
  250. +13 −6 src/html/HTMLTimeElementImp.h
  251. +1 −7 src/html/HTMLTitleElementImp.cpp
  252. +12 −9 src/html/HTMLTitleElementImp.h
  253. +1 −1 src/html/HTMLTokenizer.cpp
  254. +4 −1 src/html/HTMLTokenizer.h
  255. +1 −1 src/html/HTMLTrackElementImp.cpp
  256. +14 −7 src/html/HTMLUListElementImp.h
  257. +1 −7 src/html/HTMLUnknownElementImp.cpp
  258. +12 −9 src/html/HTMLUnknownElementImp.h
  259. +10 −4 src/html/HTMLVideoElementImp.h
  260. +2 −2 src/html/HitRegionOptionsImp.cpp
  261. +1 −1 src/html/ImageDataImp.cpp
  262. +17 −17 src/html/MediaControllerImp.cpp
  263. +7 −9 src/html/MediaQueryListImp.cpp
  264. +9 −4 src/html/MediaQueryListImp.h
  265. +2 −2 src/html/MessageChannelImp.cpp
  266. +1 −1 src/html/MessagePortImp.cpp
  267. +2 −2 src/html/RadioNodeListImp.cpp
  268. +2 −0 src/html/ScreenImp.h
  269. +4 −4 src/html/TextTrackCueImp.cpp
  270. +2 −2 src/html/TextTrackCueListImp.cpp
  271. +3 −3 src/html/TextTrackImp.cpp
  272. +3 −3 src/html/TextTrackListImp.cpp
  273. +5 −5 src/html/VideoTrackListImp.cpp
  274. +6 −1 src/http/HTTPRequest.h
  275. +2 −2 src/js/Script.cpp
  276. +2 −2 src/js/Script.h
  277. +71 −50 src/js/bridge.cpp
  278. +2 −18 src/js/esjsapi.h
  279. +11 −11 src/svg/SVGMatrixImp.cpp
  280. +2 −2 src/typedarray/ArrayBufferImp.cpp
  281. +1 −1 src/typedarray/ArrayBufferViewImp.cpp
  282. +1 −1 src/typedarray/DataViewImp.cpp
  283. +2 −2 src/typedarray/Float32ArrayImp.cpp
  284. +2 −2 src/typedarray/Float64ArrayImp.cpp
  285. +2 −2 src/typedarray/Int16ArrayImp.cpp
  286. +2 −2 src/typedarray/Int32ArrayImp.cpp
  287. +2 −2 src/typedarray/Int8ArrayImp.cpp
  288. +2 −2 src/typedarray/Uint16ArrayImp.cpp
  289. +2 −2 src/typedarray/Uint32ArrayImp.cpp
  290. +2 −2 src/typedarray/Uint8ArrayImp.cpp
  291. +1 −1 src/typedarray/Uint8ClampedArrayImp.cpp
  292. +2 −2 src/v8/ScriptV8.cpp
  293. +2 −2 src/v8/ScriptV8.h
  294. +52 −39 src/v8/bridgeV8.cpp
  295. +2 −18 src/v8/esv8api.h
  296. +1 −1 src/xbl/XBLContentElementImp.cpp
  297. +1 −1 src/xbl/XBLImplementationListImp.cpp
  298. +7 −7 src/xhr/XMLHttpRequestEventTargetImp.cpp
  299. +3 −3 src/xhr/XMLHttpRequestImp.cpp
View
@@ -1,5 +1,5 @@
/*
- * Copyright 2011 Esrille Inc.
+ * Copyright 2011, 2013 Esrille Inc.
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -55,19 +55,23 @@ class ObjectArray : public Object
arguments[2] = value;
message_(0x58994e97, "setElement", SPECIAL_SETTER_, &arguments);
}
- ObjectArray(Object* object) :
- Object(object)
- {
- }
- ObjectArray(const ObjectArray& object) :
+
+ constexpr ObjectArray() = default;
+ ObjectArray(const ObjectArray&) = default;
+ ObjectArray(ObjectArray&&) = default;
+ ObjectArray& operator=(const ObjectArray&) = default;
+ ObjectArray& operator=(ObjectArray&&) = default;
+
+ ObjectArray(const Object* object) :
Object(object)
{
}
- ObjectArray& operator=(const ObjectArray& object)
- {
- Object::operator =(object);
- return *this;
- }
+
+ template <class IMP>
+ ObjectArray(const std::shared_ptr<IMP>& pimpl) :
+ Object(std::static_pointer_cast<Imp>(pimpl))
+ {}
+
template <class IMP>
static Any dispatch(IMP* self, uint32_t selector, const char* id, int argumentCount, Any* arguments)
{
View
@@ -1,5 +1,5 @@
/*
- * Copyright 2011, 2012 Esrille Inc.
+ * Copyright 2011-2013 Esrille Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -251,7 +251,7 @@ std::u16string Any::toString() const
if (vtable->getType() == typeid(std::u16string))
return *reinterpret_cast<const std::u16string*>(&heap);
if (vtable->getType() == typeid(Object))
- return ::toString(const_cast<Object*>(reinterpret_cast<const Object*>(&heap)->self()));
+ return ::toString(const_cast<Object*>(reinterpret_cast<const Object*>(&heap)));
break;
default:
break;
@@ -341,7 +341,6 @@ unsigned int Any::toArrayIndex() const
return UINT_MAX;
}
-
// toBoolean
// Object returns true. Otherwise, false.
// NAN returns false.
@@ -381,6 +380,6 @@ bool Any::isObject() const
Object* Any::toObject() const
{
if (isObject())
- return reinterpret_cast<const Object*>(&heap)->self();
+ return const_cast<Object*>(reinterpret_cast<const Object*>(&heap));
return 0;
-}
+}
View
@@ -1,5 +1,5 @@
/*
- * Copyright 2011, 2012 Esrille Inc.
+ * Copyright 2011-2013 Esrille Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ class Any
#if defined(__APPLE__)
char s128[32];
#else
- char s128[16]; // TODO: This is for Object on x86_64.
+ char s128[24]; // TODO: This is for Object on x86_64.
#endif
};
View
@@ -1,5 +1,5 @@
/*
- * Copyright 2011 Esrille Inc.
+ * Copyright 2011, 2013 Esrille Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,17 +28,25 @@ int check(bool cond)
return cond ? EXIT_SUCCESS : EXIT_FAILURE;
}
-class X : public Object
+class X : public Imp
{
+ const char* msg;
public:
+ X (const char* msg) : msg(msg) {}
~X() {
- std::cout << __func__ << '\n';
+ std::cout << msg << '\n';
+ }
+ void hello() {
+ std::cout << msg << '\n';
}
};
+std::weak_ptr<Imp> w;
+
Any testRet()
{
- X x;
+ Object x(std::make_shared<X>("hello"));
+ w = x.self();
Any y(x);
return y;
}
@@ -47,7 +55,8 @@ int testAssign()
{
Any z;
z = testRet();
- return static_cast<int>(z);
+ std::cout << "object: " << z.isObject() << '\n';
+ return 0;
}
int main()
@@ -58,7 +67,7 @@ int main()
std::cout << "undefined: " << x.isUndefined() << '\n';
result += check(x.isUndefined());
- Any e(static_cast<Object*>(0));
+ Any e(nullptr);
std::cout << "null: " << e.isNull() << '\n';
result += check(e.isNull());
std::cout << "null: " << e.isNull() << '\n';
View
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2012 Esrille Inc.
+ * Copyright 2010-2013 Esrille Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,10 +14,13 @@
* limitations under the License.
*/
-#ifndef ATTR_IMP_H
-#define ATTR_IMP_H
+#ifndef ORG_W3C_DOM_BOOTSTRAP_ATTRIMP_H_INCLUDED
+#define ORG_W3C_DOM_BOOTSTRAP_ATTRIMP_H_INCLUDED
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#include <Object.h>
#include <org/w3c/dom/Attr.h>
namespace org { namespace w3c { namespace dom { namespace bootstrap {
@@ -51,6 +54,8 @@ class AttrImp : public ObjectMixin<AttrImp>
}
};
+typedef std::shared_ptr<AttrImp> AttrPtr;
+
}}}} // org::w3c::dom::bootstrap
-#endif // ATTR_IMP_H
+#endif // ORG_W3C_DOM_BOOTSTRAP_ATTRIMP_H_INCLUDED
View
@@ -61,58 +61,64 @@ void WindowProxy::BackgroundTask::operator()()
unsigned command;
while (!((command = sleep()) & Abort)) {
- if (!window->getWindowPtr()) {
- state = Init;
- continue;
- }
-
- //
- // Restart
- //
- if (command & Restart) {
- deleteView();
- state = Init;
- }
-
- // A binding document does not need a view.
- if (window->isBindingDocumentWindow()) {
- state = Done;
- continue;
- }
-
- //
- // Cascade
- //
- if (!view || (command & Cascade)) {
- state = Cascading;
- recordTime("%*sselector matching begin", window->windowDepth * 2, "");
- if (!view)
- view = new(std::nothrow) ViewCSSImp(window->getWindowPtr());
- if (view) {
- view->constructComputedStyles();
- state = Cascaded;
- } else
+ try {
+ if (!window->getWindowPtr()) {
state = Init;
- recordTime("%*sselector matching end", window->windowDepth * 2, "");
- continue;
- }
+ continue;
+ }
+
+ //
+ // Restart
+ //
+ if (command & Restart) {
+ deleteView();
+ state = Init;
+ }
+
+ // A binding document does not need a view.
+ if (window->isBindingDocumentWindow()) {
+ state = Done;
+ continue;
+ }
+
+ //
+ // Cascade
+ //
+ if (!view || (command & Cascade)) {
+ state = Cascading;
+ recordTime("%*sselector matching begin", window->windowDepth * 2, "");
+ if (!view)
+ view = new(std::nothrow) ViewCSSImp(window->getWindowPtr());
+ if (view) {
+ view->constructComputedStyles();
+ state = Cascaded;
+ } else
+ state = Init;
+ recordTime("%*sselector matching end", window->windowDepth * 2, "");
+ continue;
+ }
+
+ //
+ // Layout
+ //
+ if (command & Layout) {
+ state = Layouting;
+ view->setSize(window->width, window->height); // TODO: sync with mainloop
+ recordTime("%*sstyle recalculation begin", window->windowDepth * 2, "");
+ view->calculateComputedStyles();
+ recordTime("%*sstyle recalculation end", window->windowDepth * 2, "");
+ recordTime("%*sreflow begin", window->windowDepth * 2, "");
+ view->layOut();
+ recordTime("%*sreflow end", window->windowDepth * 2, "");
+ view->setFlags(Box::NEED_REPAINT);
+ }
- //
- // Layout
- //
- if (command & Layout) {
- state = Layouting;
- view->setSize(window->width, window->height); // TODO: sync with mainloop
- recordTime("%*sstyle recalculation begin", window->windowDepth * 2, "");
- view->calculateComputedStyles();
- recordTime("%*sstyle recalculation end", window->windowDepth * 2, "");
- recordTime("%*sreflow begin", window->windowDepth * 2, "");
- view->layOut();
- recordTime("%*sreflow end", window->windowDepth * 2, "");
- view->setFlags(Box::NEED_REPAINT);
+ state = Done;
+ } catch (const std::exception& e) {
+ std::cerr << "WindowProxy::BackgroundTask: " << e.what() << "\n";
+ throw;
+ // TODO: Recover from exceptions
}
-
- state = Done;
}
}
View
@@ -76,8 +76,8 @@ const char* htmlDocument =
int main(int argc, char** argv)
{
- css::CSSStyleSheet defaultStyleSheet(0);
- Document document(0);
+ css::CSSStyleSheet defaultStyleSheet;
+ Document document;
// Load the default CSS file
if (1 < argc) {
@@ -96,8 +96,8 @@ int main(int argc, char** argv)
dumpTree(std::cout, document);
// create the default view
- WindowPtr window = new(std::nothrow) WindowImp;
- window->setDocument(document);
+ WindowPtr window = std::make_shared<WindowImp>();
+ window->setDocument(std::static_pointer_cast<bootstrap::DocumentImp>(document.self()));
ViewCSSImp* view = new ViewCSSImp(window);
view->setSize(8.5f * 96, 11.0f * 96); // US letter size, 96 DPI
view->constructComputedStyles();
View
@@ -99,8 +99,8 @@ const char* htmlDocument =
int main(int argc, char** argv)
{
- css::CSSStyleSheet defaultStyleSheet(0);
- Document document(0);
+ css::CSSStyleSheet defaultStyleSheet;
+ Document document;
// Load the default CSS file
if (1 < argc) {
@@ -117,8 +117,8 @@ int main(int argc, char** argv)
assert(document);
// create the default view
- WindowPtr window = new(std::nothrow) WindowImp;
- window->setDocument(document);
+ WindowPtr window = std::make_shared<WindowImp>();
+ window->setDocument(std::static_pointer_cast<bootstrap::DocumentImp>(document.self()));
ViewCSSImp* view = new ViewCSSImp(window);
view->constructComputedStyles();
view->calculateComputedStyles();
View
@@ -17,7 +17,7 @@ namespace bootstrap
Node CaretPositionImp::getOffsetNode()
{
// TODO: implement me!
- return static_cast<Object*>(0);
+ return nullptr;
}
unsigned int CaretPositionImp::getOffset()
View
@@ -21,7 +21,7 @@ namespace org { namespace w3c { namespace dom { namespace bootstrap {
void CharacterDataImp::dispatchMutationEvent(const std::u16string& prev)
{
- events::MutationEvent event = new(std::nothrow) MutationEventImp;
+ events::MutationEvent event = std::make_shared<MutationEventImp>();
event.initMutationEvent(u"DOMCharacterDataModified",
true, false, getParentNode(), prev, data, u"", 0);
dispatchEvent(event);
@@ -42,8 +42,8 @@ void CharacterDataImp::setTextContent(const Nullable<std::u16string>& textConten
bool CharacterDataImp::isEqualNode(Node arg)
{
- CharacterDataImp* characterData = dynamic_cast<CharacterDataImp*>(arg.self());
- if (this == characterData)
+ auto characterData = std::dynamic_pointer_cast<CharacterDataImp>(arg.self());
+ if (self() == characterData)
return true;
if (!characterData)
return false;
View
@@ -35,14 +35,17 @@ class CharacterDataImp : public ObjectMixin<CharacterDataImp, NodeImp>
ObjectMixin(ownerDocument),
data(data) {
}
- CharacterDataImp(CharacterDataImp* org, bool deep) :
- ObjectMixin(org, deep),
- data(org->data)
+ CharacterDataImp(const CharacterDataImp& org) :
+ ObjectMixin(org),
+ data(org.data)
{}
// Node - override
virtual Node cloneNode(bool deep = true) {
- return new(std::nothrow) CharacterDataImp(this, deep);
+ auto node = std::make_shared<CharacterDataImp>(*this);
+ if (deep)
+ node->cloneChildren(this);
+ return node;
}
virtual Nullable<std::u16string> getTextContent();
virtual void setTextContent(const Nullable<std::u16string>& textContent);
@@ -68,6 +71,8 @@ class CharacterDataImp : public ObjectMixin<CharacterDataImp, NodeImp>
}
};
+typedef std::shared_ptr<CharacterDataImp> CharacterDataPtr;
+
}}}} // org::w3c::dom::bootstrap
#endif // CHARACTERDATA_IMP_H
Oops, something went wrong.

0 comments on commit 0c895cb

Please sign in to comment.