Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
ebf703a1
Commit
ebf703a1
authored
14 years ago
by
Mike Antipov
Browse files
Options
Downloads
Plain Diff
merge
--HG-- branch : product-engine
parents
bff974cd
356e1d55
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/newview/llinventoryobserver.cpp
+31
-23
31 additions, 23 deletions
indra/newview/llinventoryobserver.cpp
indra/newview/llinventoryobserver.h
+16
-0
16 additions, 0 deletions
indra/newview/llinventoryobserver.h
with
47 additions
and
23 deletions
indra/newview/llinventoryobserver.cpp
+
31
−
23
View file @
ebf703a1
...
@@ -62,13 +62,9 @@
...
@@ -62,13 +62,9 @@
#include
"llsdutil.h"
#include
"llsdutil.h"
#include
<deque>
#include
<deque>
// If the viewer gets a notification, your observer assumes
const
U32
LLInventoryFetchItemsObserver
::
MAX_NUM_ATTEMPTS_TO_PROCESS
=
10
;
// that that notification is for itself and then tries to process
const
F32
LLInventoryFetchItemsObserver
::
FETCH_TIMER_EXPIRY
=
10.0
f
;
// the results. The notification could be for something else (e.g.
// you're fetching an item and a notification gets triggered because
// you renamed some other item). This counter is to specify how many
// notification to wait for before giving up.
static
const
U32
MAX_NUM_NOTIFICATIONS_TO_PROCESS
=
127
;
LLInventoryObserver
::
LLInventoryObserver
()
LLInventoryObserver
::
LLInventoryObserver
()
{
{
...
@@ -149,7 +145,7 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id)
...
@@ -149,7 +145,7 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id)
LLInventoryFetchItemsObserver
::
LLInventoryFetchItemsObserver
(
const
LLUUID
&
item_id
)
:
LLInventoryFetchItemsObserver
::
LLInventoryFetchItemsObserver
(
const
LLUUID
&
item_id
)
:
LLInventoryFetchObserver
(
item_id
),
LLInventoryFetchObserver
(
item_id
),
mNumTries
(
MAX_NUM_
NOTIFICATION
S_TO_PROCESS
)
mNumTries
(
MAX_NUM_
ATTEMPT
S_TO_PROCESS
)
{
{
mIDs
.
clear
();
mIDs
.
clear
();
mIDs
.
push_back
(
item_id
);
mIDs
.
push_back
(
item_id
);
...
@@ -158,35 +154,47 @@ LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_
...
@@ -158,35 +154,47 @@ LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_
LLInventoryFetchItemsObserver
::
LLInventoryFetchItemsObserver
(
const
uuid_vec_t
&
item_ids
)
:
LLInventoryFetchItemsObserver
::
LLInventoryFetchItemsObserver
(
const
uuid_vec_t
&
item_ids
)
:
LLInventoryFetchObserver
(
item_ids
),
LLInventoryFetchObserver
(
item_ids
),
mNumTries
(
MAX_NUM_
NOTIFICATION
S_TO_PROCESS
)
mNumTries
(
MAX_NUM_
ATTEMPT
S_TO_PROCESS
)
{
{
}
}
void
LLInventoryFetchItemsObserver
::
changed
(
U32
mask
)
void
LLInventoryFetchItemsObserver
::
changed
(
U32
mask
)
{
{
BOOL
any_items_missing
=
FALSE
;
// scan through the incomplete items and move or erase them as
// scan through the incomplete items and move or erase them as
// appropriate.
// appropriate.
if
(
!
mIncomplete
.
empty
())
if
(
!
mIncomplete
.
empty
())
{
{
// if period of an attempt expired...
if
(
mFetchingPeriod
.
hasExpired
())
{
// ...reset timer and reduce count of attempts
mFetchingPeriod
.
reset
();
mFetchingPeriod
.
setTimerExpirySec
(
FETCH_TIMER_EXPIRY
);
--
mNumTries
;
LL_INFOS
(
"InventoryFetch"
)
<<
"LLInventoryFetchItemsObserver: "
<<
this
<<
", attempt(s) left: "
<<
(
S32
)
mNumTries
<<
LL_ENDL
;
}
// do we still have any attempts?
bool
timeout_expired
=
mNumTries
<=
0
;
for
(
uuid_vec_t
::
iterator
it
=
mIncomplete
.
begin
();
it
<
mIncomplete
.
end
();
)
for
(
uuid_vec_t
::
iterator
it
=
mIncomplete
.
begin
();
it
<
mIncomplete
.
end
();
)
{
{
const
LLUUID
&
item_id
=
(
*
it
);
const
LLUUID
&
item_id
=
(
*
it
);
LLViewerInventoryItem
*
item
=
gInventory
.
getItem
(
item_id
);
LLViewerInventoryItem
*
item
=
gInventory
.
getItem
(
item_id
);
if
(
!
item
)
if
(
!
item
)
{
{
any_items_missing
=
TRUE
;
if
(
timeout_expired
)
if
(
mNumTries
>
0
)
{
{
// Keep trying.
// Just concede that this item hasn't arrived in reasonable time and continue on.
++
it
;
LL_WARNS
(
"InventoryFetch"
)
<<
"Fetcher timed out when fetching inventory item UUID: "
<<
item_id
<<
LL_ENDL
;
it
=
mIncomplete
.
erase
(
it
);
}
}
else
else
{
{
// Just concede that this item hasn't arrived in reasonable time and continue on.
// Keep trying.
llwarns
<<
"Fetcher timed out when fetching inventory item assetID:"
<<
item_id
<<
llendl
;
++
it
;
it
=
mIncomplete
.
erase
(
it
);
}
}
continue
;
continue
;
}
}
...
@@ -198,14 +206,10 @@ void LLInventoryFetchItemsObserver::changed(U32 mask)
...
@@ -198,14 +206,10 @@ void LLInventoryFetchItemsObserver::changed(U32 mask)
}
}
++
it
;
++
it
;
}
}
if
(
any_items_missing
)
{
mNumTries
--
;
}
if
(
mIncomplete
.
empty
())
if
(
mIncomplete
.
empty
())
{
{
mNumTries
=
MAX_NUM_
NOTIFICATION
S_TO_PROCESS
;
mNumTries
=
MAX_NUM_
ATTEMPT
S_TO_PROCESS
;
done
();
done
();
}
}
}
}
...
@@ -315,6 +319,10 @@ void LLInventoryFetchItemsObserver::startFetch()
...
@@ -315,6 +319,10 @@ void LLInventoryFetchItemsObserver::startFetch()
item_entry
[
"item_id"
]
=
(
*
it
);
item_entry
[
"item_id"
]
=
(
*
it
);
items_llsd
.
append
(
item_entry
);
items_llsd
.
append
(
item_entry
);
}
}
mFetchingPeriod
.
resetWithExpiry
(
FETCH_TIMER_EXPIRY
);
mNumTries
=
MAX_NUM_ATTEMPTS_TO_PROCESS
;
fetch_items_from_llsd
(
items_llsd
);
fetch_items_from_llsd
(
items_llsd
);
}
}
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llinventoryobserver.h
+
16
−
0
View file @
ebf703a1
...
@@ -110,6 +110,22 @@ class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver
...
@@ -110,6 +110,22 @@ class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver
/*virtual*/
void
changed
(
U32
mask
);
/*virtual*/
void
changed
(
U32
mask
);
private:
private:
S8
mNumTries
;
// Number of times changed() was called without success
S8
mNumTries
;
// Number of times changed() was called without success
LLFrameTimer
mFetchingPeriod
;
/**
* If the viewer gets a notification, your observer assumes
* that that notification is for itself and then tries to process
* the results. The notification could be for something else (e.g.
* you're fetching an item and a notification gets triggered because
* you renamed some other item). This counter is to specify how many
* periods of time to wait for before giving up.
*/
static
const
U32
MAX_NUM_ATTEMPTS_TO_PROCESS
;
/**
* Period of waiting a notification when requested items get added into inventory.
*/
static
const
F32
FETCH_TIMER_EXPIRY
;
};
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment