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 "net/base/test_completion_callback.h" | 5 #include "net/base/test_completion_callback.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 have_result_ = false; // Auto-reset for next callback. | 30 have_result_ = false; // Auto-reset for next callback. |
31 } | 31 } |
32 | 32 |
33 TestCompletionCallbackBaseInternal::TestCompletionCallbackBaseInternal() | 33 TestCompletionCallbackBaseInternal::TestCompletionCallbackBaseInternal() |
34 : have_result_(false), | 34 : have_result_(false), |
35 waiting_for_result_(false) { | 35 waiting_for_result_(false) { |
36 } | 36 } |
37 | 37 |
38 } // namespace internal | 38 } // namespace internal |
39 | 39 |
| 40 TestClosureCallback::TestClosureCallback() |
| 41 : callback_(base::Bind(&TestClosureCallback::DidSetResult, |
| 42 base::Unretained(this))) { |
| 43 } |
| 44 |
| 45 TestClosureCallback::~TestClosureCallback() { |
| 46 } |
| 47 |
40 TestCompletionCallback::TestCompletionCallback() | 48 TestCompletionCallback::TestCompletionCallback() |
41 : callback_(base::Bind(&TestCompletionCallback::SetResult, | 49 : callback_(base::Bind(&TestCompletionCallback::SetResult, |
42 base::Unretained(this))) { | 50 base::Unretained(this))) { |
43 } | 51 } |
44 | 52 |
45 TestCompletionCallback::~TestCompletionCallback() { | 53 TestCompletionCallback::~TestCompletionCallback() { |
46 } | 54 } |
47 | 55 |
48 TestInt64CompletionCallback::TestInt64CompletionCallback() | 56 TestInt64CompletionCallback::TestInt64CompletionCallback() |
49 : callback_(base::Bind(&TestInt64CompletionCallback::SetResult, | 57 : callback_(base::Bind(&TestInt64CompletionCallback::SetResult, |
50 base::Unretained(this))) { | 58 base::Unretained(this))) { |
51 } | 59 } |
52 | 60 |
53 TestInt64CompletionCallback::~TestInt64CompletionCallback() { | 61 TestInt64CompletionCallback::~TestInt64CompletionCallback() { |
54 } | 62 } |
55 | 63 |
56 ReleaseBufferCompletionCallback::ReleaseBufferCompletionCallback( | 64 ReleaseBufferCompletionCallback::ReleaseBufferCompletionCallback( |
57 IOBuffer* buffer) : buffer_(buffer) { | 65 IOBuffer* buffer) : buffer_(buffer) { |
58 } | 66 } |
59 | 67 |
60 ReleaseBufferCompletionCallback::~ReleaseBufferCompletionCallback() { | 68 ReleaseBufferCompletionCallback::~ReleaseBufferCompletionCallback() { |
61 } | 69 } |
62 | 70 |
63 void ReleaseBufferCompletionCallback::SetResult(int result) { | 71 void ReleaseBufferCompletionCallback::SetResult(int result) { |
64 if (!buffer_->HasOneRef()) | 72 if (!buffer_->HasOneRef()) |
65 result = net::ERR_FAILED; | 73 result = net::ERR_FAILED; |
66 TestCompletionCallback::SetResult(result); | 74 TestCompletionCallback::SetResult(result); |
67 } | 75 } |
68 | 76 |
69 } // namespace net | 77 } // namespace net |
OLD | NEW |