Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
7703c036
Commit
7703c036
authored
May 11, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up acquired method.
No need to wait for async result when no acquired method is defined.
parent
350542fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
renderjs.js
renderjs.js
+16
-10
No files found.
renderjs.js
View file @
7703c036
...
...
@@ -735,9 +735,18 @@
/////////////////////////////////////////////////////////////////
function
acquire
(
child_gadget
,
method_name
,
argument_list
)
{
var
gadget
=
this
,
// Do not specify default __acquired_method_dict on prototype
// to prevent modifying this default value (with
// allowPublicAcquiredMethod for example)
aq_dict
=
gadget
.
__acquired_method_dict
||
{},
key
,
gadget_scope
;
if
(
!
aq_dict
.
hasOwnProperty
(
method_name
))
{
// "aq_dynamic is not defined"
return
gadget
.
__aq_parent
(
method_name
,
argument_list
);
}
for
(
key
in
gadget
.
__sub_gadget_dict
)
{
if
(
gadget
.
__sub_gadget_dict
.
hasOwnProperty
(
key
))
{
if
(
gadget
.
__sub_gadget_dict
[
key
]
===
child_gadget
)
{
...
...
@@ -745,17 +754,11 @@
}
}
}
return
new
RSVP
.
Queue
()
.
push
(
function
waitForAcquireMethod
()
{
// Do not specify default __acquired_method_dict on prototype
// to prevent modifying this default value (with
// allowPublicAcquiredMethod for example)
var
aq_dict
=
gadget
.
__acquired_method_dict
||
{};
if
(
aq_dict
.
hasOwnProperty
(
method_name
))
{
return
aq_dict
[
method_name
].
apply
(
gadget
,
[
argument_list
,
gadget_scope
]);
}
throw
new
renderJS
.
AcquisitionError
(
"
aq_dynamic is not defined
"
);
return
aq_dict
[
method_name
].
apply
(
gadget
,
[
argument_list
,
gadget_scope
]);
})
.
push
(
undefined
,
function
handleAcquireMethodError
(
error
)
{
if
(
error
instanceof
renderJS
.
AcquisitionError
)
{
...
...
@@ -980,7 +983,10 @@
});
gadget_instance
.
__chan
.
bind
(
"
acquire
"
,
function
handleChannelAcquire
(
trans
,
params
)
{
gadget_instance
.
__aq_parent
.
apply
(
gadget_instance
,
params
)
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget_instance
.
__aq_parent
.
apply
(
gadget_instance
,
params
);
})
.
then
(
trans
.
complete
)
.
fail
(
function
handleChannelAcquireError
(
e
)
{
trans
.
error
(
e
.
toString
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment