mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 10:40:45 -08:00
Reduce extra object creations
This commit is contained in:
parent
26822cb46a
commit
6b67bfbcc1
3 changed files with 59 additions and 44 deletions
|
|
@ -34,13 +34,14 @@
|
||||||
|
|
||||||
(defun make-clog-body (connection-id)
|
(defun make-clog-body (connection-id)
|
||||||
"Construct a new clog-body object."
|
"Construct a new clog-body object."
|
||||||
(make-instance
|
(let ((body (make-instance
|
||||||
'clog-body
|
'clog-body
|
||||||
:connection-id connection-id :html-id 0
|
:connection-id connection-id :html-id 0
|
||||||
:window (make-clog-window connection-id)
|
:window (make-clog-window connection-id)
|
||||||
:html-document (make-clog-document connection-id)
|
:html-document (make-clog-document connection-id)
|
||||||
:location (make-clog-location connection-id)
|
:location (make-clog-location connection-id)
|
||||||
:navigator (make-clog-navigator connection-id)))
|
:navigator (make-clog-navigator connection-id))))
|
||||||
|
(set-body (html-document body) body)))
|
||||||
|
|
||||||
;;;;;;;;;;;;
|
;;;;;;;;;;;;
|
||||||
;; window ;;
|
;; window ;;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,15 @@
|
||||||
;; Implementation - clog-document
|
;; Implementation - clog-document
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defclass clog-document (clog-obj)()
|
(defclass clog-document (clog-obj)
|
||||||
|
((document-element
|
||||||
|
:reader document-element
|
||||||
|
:initarg :document-element)
|
||||||
|
(head-element
|
||||||
|
:reader head-element
|
||||||
|
:initarg :head-element)
|
||||||
|
(body-element
|
||||||
|
:reader body-element))
|
||||||
(:documentation "CLOG Document Objects encapsulate the document."))
|
(:documentation "CLOG Document Objects encapsulate the document."))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
@ -22,7 +30,45 @@
|
||||||
|
|
||||||
(defun make-clog-document (connection-id)
|
(defun make-clog-document (connection-id)
|
||||||
"Construct a new clog-document. (Private)"
|
"Construct a new clog-document. (Private)"
|
||||||
(make-instance 'clog-document :connection-id connection-id :html-id "document"))
|
(make-instance
|
||||||
|
'clog-document :connection-id connection-id :html-id "document"
|
||||||
|
:document-element (make-instance 'clog-obj
|
||||||
|
:connection-id connection-id
|
||||||
|
:html-id "head")
|
||||||
|
:head-element (make-instance 'clog-obj
|
||||||
|
:connection-id connection-id
|
||||||
|
:html-id "documentElement")))
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; document-element ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric document-element (clog-document)
|
||||||
|
(:documentation "Reader for Document Element object"))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
;; head-element ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric head-element (clog-document)
|
||||||
|
(:documentation "Reader for Head Element object"))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
;; body-element ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric document-element (clog-document)
|
||||||
|
(:documentation "Reader for Body Element object"))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;
|
||||||
|
;; set-body ;;
|
||||||
|
;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defgeneric set-body (clog-document body)
|
||||||
|
(:documentation "Set the body slot after creating the
|
||||||
|
clog-documentation object. (Private)"))
|
||||||
|
|
||||||
|
(defmethod set-body ((obj clog-document) body)
|
||||||
|
(setf (slot-value obj 'body-element) body))
|
||||||
|
|
||||||
;;;;;;;;;;;;
|
;;;;;;;;;;;;
|
||||||
;; domain ;;
|
;; domain ;;
|
||||||
|
|
@ -90,36 +136,6 @@
|
||||||
(defmethod url ((obj clog-document))
|
(defmethod url ((obj clog-document))
|
||||||
(query obj "url"))
|
(query obj "url"))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; document-element ;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
(defgeneric document-element (clog-document)
|
|
||||||
(:documentation "Get document-element."))
|
|
||||||
|
|
||||||
(defmethod document-element ((obj clog-document))
|
|
||||||
(make-instance 'clog-base :connection-id (connection-id obj) :html-id "documentElement"))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
|
||||||
;; head-element ;;
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
(defgeneric head-element (clog-document)
|
|
||||||
(:documentation "Get head-element."))
|
|
||||||
|
|
||||||
(defmethod head-element ((obj clog-document))
|
|
||||||
(make-instance 'clog-base :connection-id (connection-id obj) :html-id "head"))
|
|
||||||
|
|
||||||
;;;;;;;;;;
|
|
||||||
;; body ;;
|
|
||||||
;;;;;;;;;;
|
|
||||||
|
|
||||||
(defgeneric body-element (clog-document)
|
|
||||||
(:documentation "Get body-element."))
|
|
||||||
|
|
||||||
(defmethod body-element ((obj clog-document))
|
|
||||||
(make-instance 'clog-base :connection-id (connection-id obj) :html-id "body"))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;
|
||||||
;; ready-state ;;
|
;; ready-state ;;
|
||||||
;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
||||||
|
|
@ -944,15 +944,13 @@ is nil unbind the event.</p></li>
|
||||||
<ul>
|
<ul>
|
||||||
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AHEAD-ELEMENT-20GENERIC-FUNCTION-29" >HEAD-ELEMENT</a></span></span> <span class="locative-args">CLOG-DOCUMENT</span></span></p>
|
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3AHEAD-ELEMENT-20GENERIC-FUNCTION-29" >HEAD-ELEMENT</a></span></span> <span class="locative-args">CLOG-DOCUMENT</span></span></p>
|
||||||
|
|
||||||
<p>Get head-element.</p></li>
|
<p>Reader for Head Element object</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p><a id='x-28CLOG-3ABODY-ELEMENT-20GENERIC-FUNCTION-29'></a></p>
|
<p><a id='x-28CLOG-3ABODY-ELEMENT-20GENERIC-FUNCTION-29'></a></p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3ABODY-ELEMENT-20GENERIC-FUNCTION-29" >BODY-ELEMENT</a></span></span> <span class="locative-args">CLOG-DOCUMENT</span></span></p>
|
<li><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3ABODY-ELEMENT-20GENERIC-FUNCTION-29" >BODY-ELEMENT</a></span></span> <span class="locative-args">SELF</span></span></li>
|
||||||
|
|
||||||
<p>Get body-element.</p></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p><a id='x-28CLOG-3ADOCUMENT-ELEMENT-20GENERIC-FUNCTION-29'></a></p>
|
<p><a id='x-28CLOG-3ADOCUMENT-ELEMENT-20GENERIC-FUNCTION-29'></a></p>
|
||||||
|
|
@ -960,7 +958,7 @@ is nil unbind the event.</p></li>
|
||||||
<ul>
|
<ul>
|
||||||
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3ADOCUMENT-ELEMENT-20GENERIC-FUNCTION-29" >DOCUMENT-ELEMENT</a></span></span> <span class="locative-args">CLOG-DOCUMENT</span></span></p>
|
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[generic-function]</span> <span class="reference-object"><a href="#x-28CLOG-3ADOCUMENT-ELEMENT-20GENERIC-FUNCTION-29" >DOCUMENT-ELEMENT</a></span></span> <span class="locative-args">CLOG-DOCUMENT</span></span></p>
|
||||||
|
|
||||||
<p>Get document-element.</p></li>
|
<p>Reader for Body Element object</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p><a id='x-28CLOG-3AREADY-STATE-20GENERIC-FUNCTION-29'></a></p>
|
<p><a id='x-28CLOG-3AREADY-STATE-20GENERIC-FUNCTION-29'></a></p>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue