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

Side by Side Diff: ppapi/cpp/completion_callback.h

Issue 16569002: Use HTTP response headers for PNaCl caching instead of bitcode hash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use RunAndClear Created 7 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/native_client/src/trusted/plugin/file_downloader.h » ('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 #ifndef PPAPI_CPP_COMPLETION_CALLBACK_H_ 5 #ifndef PPAPI_CPP_COMPLETION_CALLBACK_H_
6 #define PPAPI_CPP_COMPLETION_CALLBACK_H_ 6 #define PPAPI_CPP_COMPLETION_CALLBACK_H_
7 7
8 #include "ppapi/c/pp_completion_callback.h" 8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/cpp/extensions/ext_output_traits.h" 10 #include "ppapi/cpp/extensions/ext_output_traits.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 /// @param[in] result The result of the operation to be passed to the 78 /// @param[in] result The result of the operation to be passed to the
79 /// callback function. Non-positive values correspond to the error codes 79 /// callback function. Non-positive values correspond to the error codes
80 /// from <code>pp_errors.h</code> (excluding 80 /// from <code>pp_errors.h</code> (excluding
81 /// <code>PP_OK_COMPLETIONPENDING</code>). Positive values indicate 81 /// <code>PP_OK_COMPLETIONPENDING</code>). Positive values indicate
82 /// additional information such as bytes read. 82 /// additional information such as bytes read.
83 void Run(int32_t result) { 83 void Run(int32_t result) {
84 PP_DCHECK(cc_.func); 84 PP_DCHECK(cc_.func);
85 PP_RunCompletionCallback(&cc_, result); 85 PP_RunCompletionCallback(&cc_, result);
86 } 86 }
87 87
88 /// RunAndClear() is used to run the <code>CompletionCallback</code> and
89 /// clear out the callback so that it cannot be run a second time.
90 ///
91 /// @param[in] result The result of the operation to be passed to the
92 /// callback function. Non-positive values correspond to the error codes
93 /// from <code>pp_errors.h</code> (excluding
94 /// <code>PP_OK_COMPLETIONPENDING</code>). Positive values indicate
95 /// additional information such as bytes read.
96 void RunAndClear(int32_t result) {
97 PP_DCHECK(cc_.func);
98 PP_RunAndClearCompletionCallback(&cc_, result);
99 }
100
88 /// IsOptional() is used to determine the setting of the 101 /// IsOptional() is used to determine the setting of the
89 /// <code>PP_COMPLETIONCALLBACK_FLAG_OPTIONAL</code> flag. This flag allows 102 /// <code>PP_COMPLETIONCALLBACK_FLAG_OPTIONAL</code> flag. This flag allows
90 /// any method taking such callback to complete synchronously 103 /// any method taking such callback to complete synchronously
91 /// and not call the callback if the operation would not block. This is useful 104 /// and not call the callback if the operation would not block. This is useful
92 /// when performance is an issue, and the operation bandwidth should not be 105 /// when performance is an issue, and the operation bandwidth should not be
93 /// limited to the processing speed of the message loop. 106 /// limited to the processing speed of the message loop.
94 /// 107 ///
95 /// On synchronous method completion, the completion result will be returned 108 /// On synchronous method completion, the completion result will be returned
96 /// by the method itself. Otherwise, the method will return 109 /// by the method itself. Otherwise, the method will return
97 /// PP_OK_COMPLETIONPENDING, and the callback will be invoked asynchronously 110 /// PP_OK_COMPLETIONPENDING, and the callback will be invoked asynchronously
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 /// @return A <code>CompletionCallback</code> corresponding to a NULL callback. 374 /// @return A <code>CompletionCallback</code> corresponding to a NULL callback.
362 inline CompletionCallback BlockUntilComplete() { 375 inline CompletionCallback BlockUntilComplete() {
363 // Note: Explicitly inlined to avoid link errors when included into 376 // Note: Explicitly inlined to avoid link errors when included into
364 // ppapi_proxy and ppapi_cpp_objects. 377 // ppapi_proxy and ppapi_cpp_objects.
365 return CompletionCallback(); 378 return CompletionCallback();
366 } 379 }
367 380
368 } // namespace pp 381 } // namespace pp
369 382
370 #endif // PPAPI_CPP_COMPLETION_CALLBACK_H_ 383 #endif // PPAPI_CPP_COMPLETION_CALLBACK_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/native_client/src/trusted/plugin/file_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698