Hello andreip,
I'd like you to do a code review. Please execute
g4 diff -c 9171886
or point your web browser to
http://mondrian/9171886
to review the following code:
Change 9171886 by [EMAIL PROTECTED] on 2008/11/26 17:52:49 *pending*
Bug fix in Geolocation arbitrator - when calling back due to timeout
expiration, one-shot requests could result in multiple callbacks.
R=andreip
[EMAIL PROTECTED]
DELTA=13 (10 added, 2 deleted, 1 changed)
OCL=9171886
Affected files ...
... //depot/googleclient/gears/opensource/gears/geolocation/geolocation.cc#66
edit
13 delta lines: 10 added, 2 deleted, 1 changed
Also consider running:
g4 lint -c 9171886
which verifies that the changelist doesn't introduce new style violations.
If you can't do the review, please let me know as soon as possible. During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately. Visit
http://www/eng/code_review.html for more information.
This is a semiautomated message from "g4 mail". Complaints or suggestions?
Mail [EMAIL PROTECTED]
Change 9171886 by [EMAIL PROTECTED] on 2008/11/26 17:52:49 *pending*
Bug fix in Geolocation arbitrator - when calling back due to timeout
expiration, one-shot requests could result in multiple callbacks.
Affected files ...
... //depot/googleclient/gears/opensource/gears/geolocation/geolocation.cc#66
edit
==== //depot/googleclient/gears/opensource/gears/geolocation/geolocation.cc#66
-
c:\MyDocs\Gears2/googleclient/gears/opensource/gears/geolocation/geolocation.cc
====
# action=edit type=text
--- googleclient/gears/opensource/gears/geolocation/geolocation.cc
2008-11-26 18:24:10.000000000 +0000
+++ googleclient/gears/opensource/gears/geolocation/geolocation.cc
2008-11-26 17:51:20.000000000 +0000
@@ -697,9 +697,18 @@
// the case where this callback removes our final reference.
Ref();
- // Call back to JavaScript with an error.
// See if we are a one-shot:
bool is_one_shot = !fix_request_info->repeats;
+
+ // If this is a one-shot request, remove the fix request from our map, so
that
+ // position updates which occur while the callback to JavaScript is in
process
+ // do not trigger handling for this fix request.
+ if (is_one_shot) {
+ assert(fix_request_id < 0);
+ RemoveFixRequest(fix_request_id);
+ }
+
+ // Call back to JavaScript with an error.
Position position;
position.error_code = Position::ERROR_CODE_TIMEOUT;
position.error_message = STRING16(L"A position fix was not obtained within "
@@ -719,7 +728,7 @@
// that this one-shot fix request could not have been removed in
// the callback since there is no explict API that would allow an
// application to do so.
- RemoveAndDeleteFixRequest(fix_request_id);
+ DeleteFixRequest(fix_request_info);
}
Unref();
@@ -1339,7 +1348,6 @@
// Cache the pointer to the fix request because RemoveFixRequest will
// invalidate the iterator.
- LOG(("Now we crash"));
FixRequestInfo *fix_request = GetFixRequest(fix_request_id);
RemoveFixRequest(fix_request_id);
DeleteFixRequest(fix_request);