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

Side by Side Diff: ppapi/shared_impl/private/ppb_tcp_server_socket_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_tcp_server_socket_shared.h" 5 #include "ppapi/shared_impl/private/ppb_tcp_server_socket_shared.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 void PPB_TCPServerSocket_Shared::StopListening() { 72 void PPB_TCPServerSocket_Shared::StopListening() {
73 if (state_ == CLOSED) 73 if (state_ == CLOSED)
74 return; 74 return;
75 75
76 state_ = CLOSED; 76 state_ = CLOSED;
77 77
78 SendStopListening(); 78 SendStopListening();
79 socket_id_ = 0; 79 socket_id_ = 0;
80 80
81 if (listen_callback_.get()) 81 if (TrackedCallback::IsPending(listen_callback_))
82 listen_callback_->PostAbort(); 82 listen_callback_->PostAbort();
83 if (accept_callback_.get()) 83 if (TrackedCallback::IsPending(accept_callback_))
84 accept_callback_->PostAbort(); 84 accept_callback_->PostAbort();
85 tcp_socket_buffer_ = NULL; 85 tcp_socket_buffer_ = NULL;
86 } 86 }
87 87
88 void PPB_TCPServerSocket_Shared::OnListenCompleted(uint32 socket_id, 88 void PPB_TCPServerSocket_Shared::OnListenCompleted(uint32 socket_id,
89 int32_t status) { 89 int32_t status) {
90 if (state_ != BEFORE_LISTENING || 90 if (state_ != BEFORE_LISTENING ||
91 !TrackedCallback::IsPending(listen_callback_)) { 91 !TrackedCallback::IsPending(listen_callback_)) {
92 NOTREACHED(); 92 NOTREACHED();
93 return; 93 return;
94 } 94 }
95 95
96 if (status == PP_OK) { 96 if (status == PP_OK) {
97 socket_id_ = socket_id; 97 socket_id_ = socket_id;
98 state_ = LISTENING; 98 state_ = LISTENING;
99 } 99 }
100 100
101 TrackedCallback::ClearAndRun(&listen_callback_, status); 101 listen_callback_->Run(status);
102 } 102 }
103 103
104 } // namespace ppapi 104 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/private/ppb_host_resolver_shared.cc ('k') | ppapi/shared_impl/private/tcp_socket_private_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698