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

Side by Side Diff: ppapi/utility/private/network_list_observer_private.cc

Issue 10381002: Pepper: Make users of pp:NetworkMonitorPrivate less likely to leak resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: doh Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ppapi/utility/private/network_list_observer_private.h" 5 #include "ppapi/utility/private/network_list_observer_private.h"
6 6
7 #include "ppapi/cpp/private/network_list_private.h" 7 #include "ppapi/cpp/private/network_list_private.h"
8 #include "ppapi/cpp/module.h" 8 #include "ppapi/cpp/module.h"
9 9
10 namespace pp { 10 namespace pp {
11 11
12 NetworkListObserverPrivate::NetworkListObserverPrivate( 12 NetworkListObserverPrivate::NetworkListObserverPrivate(
13 const InstanceHandle& instance) 13 const InstanceHandle& instance)
14 : PP_ALLOW_THIS_IN_INITIALIZER_LIST( 14 : PP_ALLOW_THIS_IN_INITIALIZER_LIST(
15 monitor_(instance, 15 monitor_(instance,
16 &NetworkListObserverPrivate::NetworkListCallbackHandler, 16 &NetworkListObserverPrivate::NetworkListCallbackHandler,
17 this)) { 17 this)) {
18 } 18 }
19 19
20 NetworkListObserverPrivate::~NetworkListObserverPrivate() { 20 NetworkListObserverPrivate::~NetworkListObserverPrivate() {
21 } 21 }
22 22
23 // static 23 // static
24 void NetworkListObserverPrivate::NetworkListCallbackHandler( 24 void NetworkListObserverPrivate::NetworkListCallbackHandler(
25 void* user_data, 25 void* user_data,
26 PP_Resource list_resource) { 26 PP_Resource list_resource) {
27 NetworkListObserverPrivate* object = 27 NetworkListObserverPrivate* object =
28 static_cast<NetworkListObserverPrivate*>(user_data); 28 static_cast<NetworkListObserverPrivate*>(user_data);
29 NetworkListPrivate list(list_resource); 29 NetworkListPrivate list(PASS_REF, list_resource);
30 object->OnNetworkListChanged(list); 30 object->OnNetworkListChanged(list);
31 Module::Get()->core()->ReleaseResource(list_resource);
32 } 31 }
33 32
34 } // namespace pp 33 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/tests/test_network_monitor_private.cc ('k') | remoting/client/plugin/pepper_network_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698