forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce net::CompletionOnceCallback.
Also convert net::FileStreamContext to use it, as a sample use case with few consumers. This CL does not add a OnceCallback version of TestCompletionCallback, as the repeating version works for use with methods that take OnceCallbacks. I think not creating a new test class will make updating interfaces take a lot less effort. Also, I expect that all net::CompletionCallbacks are effectively used as OnceCallbacks, so we can make TestCompletionCallback return OnceCallbacks when/if we ever finish converting all of net to use CompletionOnceCallbacks. Bug: 714018 Change-Id: Iec76deae075b32fe0c65eb18596859f5e6413647 Reviewed-on: https://chromium-review.googlesource.com/853092 Commit-Queue: Matt Menke <mmenke@chromium.org> Reviewed-by: Randy Smith <rdsmith@chromium.org> Cr-Commit-Position: refs/heads/master@{#533061}
- Loading branch information
Matt Menke
authored and
Commit Bot
committed
Jan 30, 2018
1 parent
006fd61
commit dadd6c7
Showing
12 changed files
with
199 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef NET_BASE_COMPLETION_ONCE_CALLBACK_H_ | ||
#define NET_BASE_COMPLETION_ONCE_CALLBACK_H_ | ||
|
||
#include <stdint.h> | ||
|
||
#include "base/callback.h" | ||
#include "base/cancelable_callback.h" | ||
|
||
namespace net { | ||
|
||
// A OnceCallback specialization that takes a single int parameter. Usually this | ||
// is used to report a byte count or network error code. | ||
typedef base::OnceCallback<void(int)> CompletionOnceCallback; | ||
|
||
// 64bit version of the OnceCallback specialization that takes a single int64_t | ||
// parameter. Usually this is used to report a file offset, size or network | ||
// error code. | ||
typedef base::OnceCallback<void(int64_t)> Int64CompletionOnceCallback; | ||
|
||
typedef base::CancelableOnceCallback<void(int)> | ||
CancelableCompletionOnceCallback; | ||
|
||
} // namespace net | ||
|
||
#endif // NET_BASE_COMPLETION_ONCE_CALLBACK_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.