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

Unified Diff: native_client_sdk/src/examples/websocket/websocket.cc

Issue 10905128: Pepper WebSocket API: Fix memory leak issue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: done Created 8 years, 3 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/cpp/var.cc » ('j') | ppapi/cpp/var.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/examples/websocket/websocket.cc
diff --git a/native_client_sdk/src/examples/websocket/websocket.cc b/native_client_sdk/src/examples/websocket/websocket.cc
index fc1f0ed73d5c26978b67e01198216cc07af0aeb0..784576f89dbdf81e0dba24d7ed4a2071c606c75b 100644
--- a/native_client_sdk/src/examples/websocket/websocket.cc
+++ b/native_client_sdk/src/examples/websocket/websocket.cc
@@ -96,6 +96,8 @@ void WebSocketInstance::Send(const std::string& message) {
}
void WebSocketInstance::Receive() {
+ // Release old var resource if it is reused.
+ pp::Var release(pp::PASS_REF, receive_var_.Detach());
Takashi Toyoshima 2012/09/07 17:18:27 If we want to reuse the same pp::Var to receive re
dmichael (off chromium) 2012/09/07 18:36:58 What if we just make ReceiveMessage release the va
Takashi Toyoshima 2012/09/10 13:21:27 OK. I'll do '*message = Var();' in ReceiveMessage
pp::CompletionCallback callback(OnReceiveCompletionCallback, this);
// |receive_var_| must be valid until |callback| is invoked.
// Just use a member variable.
« no previous file with comments | « no previous file | ppapi/cpp/var.cc » ('j') | ppapi/cpp/var.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698