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

Side by Side Diff: ppapi/shared_impl/private/ppb_host_resolver_shared.cc

Issue 10909244: PPAPI: Get TrackedCallback ready for running on non-main threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged. Created 8 years, 1 month 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/shared_impl/private/ppb_host_resolver_shared.h" 5 #include "ppapi/shared_impl/private/ppb_host_resolver_shared.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const std::string& canonical_name, 77 const std::string& canonical_name,
78 const std::vector<PP_NetAddress_Private>& net_address_list) { 78 const std::vector<PP_NetAddress_Private>& net_address_list) {
79 if (succeeded) { 79 if (succeeded) {
80 canonical_name_ = canonical_name; 80 canonical_name_ = canonical_name;
81 net_address_list_ = net_address_list; 81 net_address_list_ = net_address_list;
82 } else { 82 } else {
83 canonical_name_.clear(); 83 canonical_name_.clear();
84 net_address_list_.clear(); 84 net_address_list_.clear();
85 } 85 }
86 86
87 TrackedCallback::ClearAndRun(&resolve_callback_, 87 resolve_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED);
88 succeeded ? PP_OK : PP_ERROR_FAILED);
89 } 88 }
90 89
91 uint32 PPB_HostResolver_Shared::GenerateHostResolverID() { 90 uint32 PPB_HostResolver_Shared::GenerateHostResolverID() {
92 static uint32 host_resolver_id = 0; 91 static uint32 host_resolver_id = 0;
93 return host_resolver_id++; 92 return host_resolver_id++;
94 } 93 }
95 94
96 bool PPB_HostResolver_Shared::ResolveInProgress() const { 95 bool PPB_HostResolver_Shared::ResolveInProgress() const {
97 return TrackedCallback::IsPending(resolve_callback_); 96 return TrackedCallback::IsPending(resolve_callback_);
98 } 97 }
99 98
100 } // namespace ppapi 99 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_video_decoder_shared.cc ('k') | ppapi/shared_impl/private/ppb_tcp_server_socket_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698