Chromium Code Reviews| 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 /// MyHandler() : factory_(this), offset_(0) { | 182 /// MyHandler() |
| 183 /// : factory_(PP_ALLOW_THIS_IN_INITIALIZER_LIST(this)), offset_(0) { | |
|
dmichael (off chromium)
2011/12/09 23:05:26
Actually, this macro is really just a way around a
Takashi Toyoshima
2011/12/13 14:08:23
Done.
| |
| 183 /// } | 184 /// } |
| 184 /// | 185 /// |
| 185 /// void ProcessFile(const FileRef& file) { | 186 /// void ProcessFile(const FileRef& file) { |
| 186 /// CompletionCallback cc = factory_.NewRequiredCallback( | 187 /// CompletionCallback cc = factory_.NewRequiredCallback( |
| 187 /// &MyHandler::DidOpen); | 188 /// &MyHandler::DidOpen); |
| 188 /// int32_t rv = fio_.Open(file, PP_FileOpenFlag_Read, cc); | 189 /// int32_t rv = fio_.Open(file, PP_FileOpenFlag_Read, cc); |
| 189 /// CHECK(rv == PP_OK_COMPLETIONPENDING); | 190 /// CHECK(rv == PP_OK_COMPLETIONPENDING); |
| 190 /// } | 191 /// } |
| 191 /// | 192 /// |
| 192 /// private: | 193 /// private: |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 CompletionCallbackFactory(const CompletionCallbackFactory&); | 700 CompletionCallbackFactory(const CompletionCallbackFactory&); |
| 700 CompletionCallbackFactory& operator=(const CompletionCallbackFactory&); | 701 CompletionCallbackFactory& operator=(const CompletionCallbackFactory&); |
| 701 | 702 |
| 702 T* object_; | 703 T* object_; |
| 703 BackPointer* back_pointer_; | 704 BackPointer* back_pointer_; |
| 704 }; | 705 }; |
| 705 | 706 |
| 706 } // namespace pp | 707 } // namespace pp |
| 707 | 708 |
| 708 #endif // PPAPI_CPP_COMPLETION_CALLBACK_H_ | 709 #endif // PPAPI_CPP_COMPLETION_CALLBACK_H_ |
| OLD | NEW |