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

Unified Diff: google_apis/gcm/engine/gcm_store.h

Issue 147193003: [GCM] Fix memory leaks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows Created 6 years, 11 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 | google_apis/gcm/engine/gcm_store_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/engine/gcm_store.h
diff --git a/google_apis/gcm/engine/gcm_store.h b/google_apis/gcm/engine/gcm_store.h
index d26ca18ec46c96f8bafa74c20a539e239d8e20b4..ed979499099e404d128f68f2382fbc7a9765c379 100644
--- a/google_apis/gcm/engine/gcm_store.h
+++ b/google_apis/gcm/engine/gcm_store.h
@@ -11,8 +11,11 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
+#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "google_apis/gcm/base/gcm_export.h"
+#include "google_apis/gcm/protocol/mcs.pb.h"
namespace google {
namespace protobuf {
@@ -28,6 +31,10 @@ class MCSMessage;
// as well as store device and user checkin information.
class GCM_EXPORT GCMStore {
public:
+ // Map of message id to message data for outgoing messages.
+ typedef std::map<std::string, linked_ptr<google::protobuf::MessageLite> >
+ OutgoingMessageMap;
+
// Part of load results storing user serial number mapping related values.
struct GCM_EXPORT SerialNumberMappings {
SerialNumberMappings();
@@ -46,13 +53,12 @@ class GCM_EXPORT GCMStore {
uint64 device_android_id;
uint64 device_security_token;
std::vector<std::string> incoming_messages;
- std::map<std::string, google::protobuf::MessageLite*> outgoing_messages;
+ OutgoingMessageMap outgoing_messages;
SerialNumberMappings serial_number_mappings;
};
typedef std::vector<std::string> PersistentIdList;
- // Note: callee receives ownership of |outgoing_messages|' values.
- typedef base::Callback<void(const LoadResult& result)> LoadCallback;
+ typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback;
typedef base::Callback<void(bool success)> UpdateCallback;
GCMStore();
« no previous file with comments | « no previous file | google_apis/gcm/engine/gcm_store_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698