-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcallback_types.go
More file actions
38 lines (27 loc) · 2.07 KB
/
callback_types.go
File metadata and controls
38 lines (27 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package cronet
// ExecutorExecuteFunc takes ownership of |command| and runs it synchronously or asynchronously.
// Destroys the |command| after execution, or if executor is shutting down.
type ExecutorExecuteFunc func(executor Executor, command Runnable)
// RunnableRunFunc is the function type for Runnable.Run callback.
type RunnableRunFunc func(self Runnable)
// BufferCallbackFunc is called when the Buffer is destroyed.
type BufferCallbackFunc func(callback BufferCallback, buffer Buffer)
// URLRequestStatusListenerOnStatusFunc is called with the status of a URL request.
type URLRequestStatusListenerOnStatusFunc func(self URLRequestStatusListener, status URLRequestStatusListenerStatus)
// URLRequestFinishedInfoListenerOnRequestFinishedFunc is called when a request finishes.
type URLRequestFinishedInfoListenerOnRequestFinishedFunc func(listener URLRequestFinishedInfoListener, requestInfo RequestFinishedInfo, responseInfo URLResponseInfo, error Error)
// URLRequestCallbackHandler handles callbacks from URLRequest.
type URLRequestCallbackHandler interface {
// OnRedirectReceived is invoked whenever a redirect is encountered.
OnRedirectReceived(self URLRequestCallback, request URLRequest, info URLResponseInfo, newLocationUrl string)
// OnResponseStarted is invoked when the final set of headers, after all redirects, is received.
OnResponseStarted(self URLRequestCallback, request URLRequest, info URLResponseInfo)
// OnReadCompleted is invoked whenever part of the response body has been read.
OnReadCompleted(self URLRequestCallback, request URLRequest, info URLResponseInfo, buffer Buffer, bytesRead int64)
// OnSucceeded is invoked when request is completed successfully.
OnSucceeded(self URLRequestCallback, request URLRequest, info URLResponseInfo)
// OnFailed is invoked if request failed for any reason after URLRequest.Start().
OnFailed(self URLRequestCallback, request URLRequest, info URLResponseInfo, error Error)
// OnCanceled is invoked if request was canceled via URLRequest.Cancel().
OnCanceled(self URLRequestCallback, request URLRequest, info URLResponseInfo)
}