| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // See http://wiki.corp.google.com/twiki/bin/view/Main/ChromeMultiProcessResourc
eLoading | 5 // See http://wiki.corp.google.com/twiki/bin/view/Main/ChromeMultiProcessResourc
eLoading |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/resource_dispatcher_host.h" | 9 #include "chrome/browser/resource_dispatcher_host.h" |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Uncomment to enable logging of request traffic. | 44 // Uncomment to enable logging of request traffic. |
| 45 //#define LOG_RESOURCE_DISPATCHER_REQUESTS | 45 //#define LOG_RESOURCE_DISPATCHER_REQUESTS |
| 46 | 46 |
| 47 #ifdef LOG_RESOURCE_DISPATCHER_REQUESTS | 47 #ifdef LOG_RESOURCE_DISPATCHER_REQUESTS |
| 48 # define RESOURCE_LOG(stuff) LOG(INFO) << stuff | 48 # define RESOURCE_LOG(stuff) LOG(INFO) << stuff |
| 49 #else | 49 #else |
| 50 # define RESOURCE_LOG(stuff) | 50 # define RESOURCE_LOG(stuff) |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 using base::Time; |
| 54 using base::TimeDelta; |
| 55 using base::TimeTicks; |
| 56 |
| 53 // ---------------------------------------------------------------------------- | 57 // ---------------------------------------------------------------------------- |
| 54 | 58 |
| 55 // The interval for calls to ResourceDispatcherHost::UpdateLoadStates | 59 // The interval for calls to ResourceDispatcherHost::UpdateLoadStates |
| 56 static const int kUpdateLoadStatesIntervalMsec = 100; | 60 static const int kUpdateLoadStatesIntervalMsec = 100; |
| 57 | 61 |
| 58 // Maximum number of pending data messages sent to the renderer at any | 62 // Maximum number of pending data messages sent to the renderer at any |
| 59 // given time for a given request. | 63 // given time for a given request. |
| 60 static const int kMaxPendingDataMessages = 20; | 64 static const int kMaxPendingDataMessages = 20; |
| 61 | 65 |
| 62 // Maximum time to wait for a gethash response from the Safe Browsing servers. | 66 // Maximum time to wait for a gethash response from the Safe Browsing servers. |
| (...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 bool enough_new_progress = (amt_since_last > (size / kHalfPercentIncrements)); | 2489 bool enough_new_progress = (amt_since_last > (size / kHalfPercentIncrements)); |
| 2486 bool too_much_time_passed = time_since_last > kOneSecond; | 2490 bool too_much_time_passed = time_since_last > kOneSecond; |
| 2487 | 2491 |
| 2488 if (is_finished || enough_new_progress || too_much_time_passed) { | 2492 if (is_finished || enough_new_progress || too_much_time_passed) { |
| 2489 info->event_handler->OnUploadProgress(info->request_id, position, size); | 2493 info->event_handler->OnUploadProgress(info->request_id, position, size); |
| 2490 info->waiting_for_upload_progress_ack = true; | 2494 info->waiting_for_upload_progress_ack = true; |
| 2491 info->last_upload_ticks = TimeTicks::Now(); | 2495 info->last_upload_ticks = TimeTicks::Now(); |
| 2492 info->last_upload_position = position; | 2496 info->last_upload_position = position; |
| 2493 } | 2497 } |
| 2494 } | 2498 } |
| OLD | NEW |