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

Side by Side Diff: remoting/client/plugin/pepper_network_manager.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
« no previous file with comments | « ppapi/utility/private/network_list_observer_private.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "remoting/client/plugin/pepper_network_manager.h" 5 #include "remoting/client/plugin/pepper_network_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "ppapi/cpp/module.h" 9 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/private/network_list_private.h" 10 #include "ppapi/cpp/private/network_list_private.h"
(...skipping 26 matching lines...) Expand all
37 void PepperNetworkManager::StopUpdating() { 37 void PepperNetworkManager::StopUpdating() {
38 DCHECK_GT(start_count_, 0); 38 DCHECK_GT(start_count_, 0);
39 --start_count_; 39 --start_count_;
40 } 40 }
41 41
42 // static 42 // static
43 void PepperNetworkManager::OnNetworkListCallbackHandler( 43 void PepperNetworkManager::OnNetworkListCallbackHandler(
44 void* user_data, 44 void* user_data,
45 PP_Resource list_resource) { 45 PP_Resource list_resource) {
46 PepperNetworkManager* object = static_cast<PepperNetworkManager*>(user_data); 46 PepperNetworkManager* object = static_cast<PepperNetworkManager*>(user_data);
47 pp::NetworkListPrivate list(list_resource); 47 pp::NetworkListPrivate list(pp::PASS_REF, list_resource);
48 object->OnNetworkList(list); 48 object->OnNetworkList(list);
49 pp::Module::Get()->core()->ReleaseResource(list_resource);
50 } 49 }
51 50
52 void PepperNetworkManager::OnNetworkList(const pp::NetworkListPrivate& list) { 51 void PepperNetworkManager::OnNetworkList(const pp::NetworkListPrivate& list) {
53 network_list_received_ = true; 52 network_list_received_ = true;
54 53
55 std::vector<talk_base::Network*> networks; 54 std::vector<talk_base::Network*> networks;
56 size_t count = list.GetCount(); 55 size_t count = list.GetCount();
57 for (size_t i = 0; i < count; i++) { 56 for (size_t i = 0; i < count; i++) {
58 std::vector<PP_NetAddress_Private> addresses; 57 std::vector<PP_NetAddress_Private> addresses;
59 list.GetIpAddresses(i, &addresses); 58 list.GetIpAddresses(i, &addresses);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 MergeNetworkList(networks, &changed); 102 MergeNetworkList(networks, &changed);
104 if (changed) 103 if (changed)
105 SignalNetworksChanged(); 104 SignalNetworksChanged();
106 } 105 }
107 106
108 void PepperNetworkManager::SendNetworksChangedSignal() { 107 void PepperNetworkManager::SendNetworksChangedSignal() {
109 SignalNetworksChanged(); 108 SignalNetworksChanged();
110 } 109 }
111 110
112 } // namespace remoting 111 } // namespace remoting
OLDNEW
« no previous file with comments | « ppapi/utility/private/network_list_observer_private.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698