| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 10 #include "ppapi/cpp/logging.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 /// creates/destroys the factory. With this restriction, it is safe to create | 172 /// creates/destroys the factory. With this restriction, it is safe to create |
| 173 /// the <code>CompletionCallbackFactory</code> on the main thread, create | 173 /// the <code>CompletionCallbackFactory</code> on the main thread, create |
| 174 /// callbacks from any thread and pass them to CallOnMainThread(). | 174 /// callbacks from any thread and pass them to CallOnMainThread(). |
| 175 /// | 175 /// |
| 176 /// <strong>Example: </strong> | 176 /// <strong>Example: </strong> |
| 177 /// | 177 /// |
| 178 /// @code | 178 /// @code |
| 179 /// | 179 /// |
| 180 /// class MyHandler { | 180 /// class MyHandler { |
| 181 /// public: | 181 /// public: |
| 182 /// // If an compiler warns on following using |this| in the initializer |
| 183 /// // list, use PP_ALLOW_THIS_IN_INITIALIZER_LIST macro. |
| 182 /// MyHandler() : factory_(this), offset_(0) { | 184 /// MyHandler() : factory_(this), offset_(0) { |
| 183 /// } | 185 /// } |
| 184 /// | 186 /// |
| 185 /// void ProcessFile(const FileRef& file) { | 187 /// void ProcessFile(const FileRef& file) { |
| 186 /// CompletionCallback cc = factory_.NewRequiredCallback( | 188 /// CompletionCallback cc = factory_.NewRequiredCallback( |
| 187 /// &MyHandler::DidOpen); | 189 /// &MyHandler::DidOpen); |
| 188 /// int32_t rv = fio_.Open(file, PP_FileOpenFlag_Read, cc); | 190 /// int32_t rv = fio_.Open(file, PP_FileOpenFlag_Read, cc); |
| 189 /// CHECK(rv == PP_OK_COMPLETIONPENDING); | 191 /// CHECK(rv == PP_OK_COMPLETIONPENDING); |
| 190 /// } | 192 /// } |
| 191 /// | 193 /// |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 CompletionCallbackFactory(const CompletionCallbackFactory&); | 701 CompletionCallbackFactory(const CompletionCallbackFactory&); |
| 700 CompletionCallbackFactory& operator=(const CompletionCallbackFactory&); | 702 CompletionCallbackFactory& operator=(const CompletionCallbackFactory&); |
| 701 | 703 |
| 702 T* object_; | 704 T* object_; |
| 703 BackPointer* back_pointer_; | 705 BackPointer* back_pointer_; |
| 704 }; | 706 }; |
| 705 | 707 |
| 706 } // namespace pp | 708 } // namespace pp |
| 707 | 709 |
| 708 #endif // PPAPI_CPP_COMPLETION_CALLBACK_H_ | 710 #endif // PPAPI_CPP_COMPLETION_CALLBACK_H_ |
| OLD | NEW |