OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/download/base_file.h" | 5 #include "content/browser/download/base_file.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 net::Error LogError(const char* file, | 43 net::Error LogError(const char* file, |
44 int line, | 44 int line, |
45 const char* func, | 45 const char* func, |
46 const net::BoundNetLog& bound_net_log, | 46 const net::BoundNetLog& bound_net_log, |
47 const char* operation, | 47 const char* operation, |
48 int error) { | 48 int error) { |
49 const char* err_string = ""; | 49 const char* err_string = ""; |
50 net::Error net_error = net::OK; | 50 net::Error net_error = net::OK; |
51 | 51 |
52 #define NET_ERROR(label, value) \ | 52 #define NET_ERROR(label, value) \ |
53 case net::ERR_##label: \ | 53 case net::label: \ |
54 err_string = #label; \ | 54 err_string = #label; \ |
55 net_error = net::ERR_##label; \ | 55 net_error = net::label; \ |
56 break; | 56 break; |
57 | 57 |
58 switch (error) { | 58 switch (error) { |
59 case net::OK: | 59 case net::OK: |
60 return net::OK; | 60 return net::OK; |
61 | 61 |
62 #include "net/base/net_error_list.h" | 62 #include "net/base/net_error_list.h" |
63 | 63 |
64 default: | 64 default: |
65 err_string = "Unexpected enum value"; | 65 err_string = "Unexpected enum value"; |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 base::TimeDelta diff = current_time - start_tick_; | 551 base::TimeDelta diff = current_time - start_tick_; |
552 int64 diff_ms = diff.InMilliseconds(); | 552 int64 diff_ms = diff.InMilliseconds(); |
553 return diff_ms == 0 ? 0 : bytes_so_far() * 1000 / diff_ms; | 553 return diff_ms == 0 ? 0 : bytes_so_far() * 1000 / diff_ms; |
554 } | 554 } |
555 | 555 |
556 int64 BaseFile::CurrentSpeed() const { | 556 int64 BaseFile::CurrentSpeed() const { |
557 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 557 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
558 return CurrentSpeedAtTime(base::TimeTicks::Now()); | 558 return CurrentSpeedAtTime(base::TimeTicks::Now()); |
559 } | 559 } |
560 | 560 |
OLD | NEW |