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

Unified Diff: ppapi/tests/test_utils.h

Issue 10661026: WebSocket Pepper API: allow to release in completion callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use WeakPtr to protect |this| Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/tests/test_utils.cc » ('j') | ppapi/tests/test_websocket.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_utils.h
diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h
index 1e2ec369316475accbd41d986e2a22f40d0d1bb0..2faa6feb46385b3c0a5770c374e4c5ac75732fe0 100644
--- a/ppapi/tests/test_utils.h
+++ b/ppapi/tests/test_utils.h
@@ -62,12 +62,18 @@ class NestedEvent {
enum CallbackType { PP_REQUIRED, PP_OPTIONAL, PP_BLOCKING };
class TestCompletionCallback {
public:
+ class Delegate {
+ public:
+ virtual void OnCallback(void* user_data, int32_t result) = 0;
+ };
explicit TestCompletionCallback(PP_Instance instance);
// TODO(dmichael): Remove this constructor.
TestCompletionCallback(PP_Instance instance, bool force_async);
TestCompletionCallback(PP_Instance instance, CallbackType callback_type);
+ void SetDelegate(Delegate* delegate) { delegate_ = delegate; }
dmichael (off chromium) 2012/06/25 15:50:51 Please add documentation for the method, including
Takashi Toyoshima 2012/06/26 09:19:10 Done.
+
// Waits for the callback to be called and returns the
// result. Returns immediately if the callback was previously called
// and the result wasn't returned (i.e. each result value received
@@ -153,6 +159,7 @@ class TestCompletionCallback {
std::string errors_;
unsigned run_count_;
PP_Instance instance_;
+ Delegate* delegate_;
};
// Verifies that the callback didn't record any errors. If the callback is run
« no previous file with comments | « no previous file | ppapi/tests/test_utils.cc » ('j') | ppapi/tests/test_websocket.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698