Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: net/base/test_completion_callback.cc

Issue 693943003: Update from https://crrev.com/302630 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/test_completion_callback.h ('k') | net/base/test_completion_callback_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 waiting_for_result_ = false; 28 waiting_for_result_ = false;
29 } 29 }
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 TestCompletionCallbackBaseInternal::~TestCompletionCallbackBaseInternal() {
39 }
40
38 } // namespace internal 41 } // namespace internal
39 42
43 TestClosure::TestClosure()
44 : closure_(base::Bind(&TestClosure::DidSetResult, base::Unretained(this))) {
45 }
46
47 TestClosure::~TestClosure() {
48 }
49
40 TestCompletionCallback::TestCompletionCallback() 50 TestCompletionCallback::TestCompletionCallback()
41 : callback_(base::Bind(&TestCompletionCallback::SetResult, 51 : callback_(base::Bind(&TestCompletionCallback::SetResult,
42 base::Unretained(this))) { 52 base::Unretained(this))) {
43 } 53 }
44 54
45 TestCompletionCallback::~TestCompletionCallback() { 55 TestCompletionCallback::~TestCompletionCallback() {
46 } 56 }
47 57
48 TestInt64CompletionCallback::TestInt64CompletionCallback() 58 TestInt64CompletionCallback::TestInt64CompletionCallback()
49 : callback_(base::Bind(&TestInt64CompletionCallback::SetResult, 59 : callback_(base::Bind(&TestInt64CompletionCallback::SetResult,
50 base::Unretained(this))) { 60 base::Unretained(this))) {
51 } 61 }
52 62
53 TestInt64CompletionCallback::~TestInt64CompletionCallback() { 63 TestInt64CompletionCallback::~TestInt64CompletionCallback() {
54 } 64 }
55 65
56 ReleaseBufferCompletionCallback::ReleaseBufferCompletionCallback( 66 ReleaseBufferCompletionCallback::ReleaseBufferCompletionCallback(
57 IOBuffer* buffer) : buffer_(buffer) { 67 IOBuffer* buffer) : buffer_(buffer) {
58 } 68 }
59 69
60 ReleaseBufferCompletionCallback::~ReleaseBufferCompletionCallback() { 70 ReleaseBufferCompletionCallback::~ReleaseBufferCompletionCallback() {
61 } 71 }
62 72
63 void ReleaseBufferCompletionCallback::SetResult(int result) { 73 void ReleaseBufferCompletionCallback::SetResult(int result) {
64 if (!buffer_->HasOneRef()) 74 if (!buffer_->HasOneRef())
65 result = net::ERR_FAILED; 75 result = net::ERR_FAILED;
66 TestCompletionCallback::SetResult(result); 76 TestCompletionCallback::SetResult(result);
67 } 77 }
68 78
69 } // namespace net 79 } // namespace net
OLDNEW
« no previous file with comments | « net/base/test_completion_callback.h ('k') | net/base/test_completion_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698