Hello andreip,
I'd like you to do a code review. Please execute
g4 diff -c 8288057
or point your web browser to
http://mondrian/8288057
(this changelist has been uploaded to Mondrian)
to review the following code:
Change 8288057 by [EMAIL PROTECTED] on 2008/09/16 22:03:58 *pending*
Bug fix in network location provider.
PRESUBMIT=passed
R=andreip
[EMAIL PROTECTED]
DELTA=21 (7 added, 5 deleted, 9 changed)
OCL=8288057
Affected files ...
...
//depot/googleclient/gears/opensource/gears/geolocation/network_location_provider.cc#24
edit
21 delta lines: 7 added, 5 deleted, 9 changed
Also consider running:
g4 lint -c 8288057
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 8288057 by [EMAIL PROTECTED] on 2008/09/16 22:03:58 *pending*
Bug fix in network location provider.
Affected files ...
...
//depot/googleclient/gears/opensource/gears/geolocation/network_location_provider.cc#24
edit
====
//depot/googleclient/gears/opensource/gears/geolocation/network_location_provider.cc#24
-
c:\MyDocs\Gears10/googleclient/gears/opensource/gears/geolocation/network_location_provider.cc
====
# action=edit type=text
---
googleclient/gears/opensource/gears/geolocation/network_location_provider.cc
2008-09-25 17:14:55.000000000 +0100
+++
googleclient/gears/opensource/gears/geolocation/network_location_provider.cc
2008-09-25 11:52:43.000000000 +0100
@@ -393,25 +393,27 @@
//
// This loop is structured such that we don't require mutex locks to
// synchronise changes to is_new_data_available_ etc with signals on
- // thread_notification_event_.
+ // thread_notification_event_. Note that if we get a signal before we wait,
+ // the wait will proceed immediately, so we don't miss signals.
int64 remaining_time = 1;
while (!is_shutting_down_) {
- // If the current request is complete, see if we need to wait for the time
- // to expire. If not, just wait for an event.
- if (is_last_request_complete_ && remaining_time > 0) {
- // earliest_next_request_time_ is updated when the current request
- // completes.
+ if (remaining_time > 0) {
remaining_time = earliest_next_request_time_ - GetCurrentTimeMillis();
- // If the minimum time period has not yet elapsed, set the timeout such
- // that the wait expires when the period has elapsed.
- if (remaining_time > 0) {
- thread_notification_event_.WaitWithTimeout(
- static_cast<int>(remaining_time));
- } else {
- thread_notification_event_.Wait();
- }
+ }
+
+ // If the minimum time period has not yet elapsed, set the timeout such
+ // that the wait expires when the period has elapsed.
+ if (remaining_time > 0) {
+ thread_notification_event_.WaitWithTimeout(
+ static_cast<int>(remaining_time));
} else {
thread_notification_event_.Wait();
+ }
+
+ // Update remaining time now we've woken up. Note that it can never
transition
+ // from <= 0 to > 0.
+ if (remaining_time > 0) {
+ remaining_time = earliest_next_request_time_ - GetCurrentTimeMillis();
}
bool make_request = false;