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

Side by Side Diff: ppapi/utility/websocket/websocket_api.cc

Issue 324453003: PPAPI: Remove PP_ALLOW_THIS_IN_INITIALIZER_LIST (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/tests/test_message_loop.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 "ppapi/utility/websocket/websocket_api.h" 5 #include "ppapi/utility/websocket/websocket_api.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/pp_macros.h" 8 #include "ppapi/c/pp_macros.h"
9 #include "ppapi/cpp/instance.h" 9 #include "ppapi/cpp/instance.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
11 #include "ppapi/cpp/module_impl.h" 11 #include "ppapi/cpp/module_impl.h"
12 #include "ppapi/cpp/var.h" 12 #include "ppapi/cpp/var.h"
13 #include "ppapi/cpp/websocket.h" 13 #include "ppapi/cpp/websocket.h"
14 #include "ppapi/utility/completion_callback_factory.h" 14 #include "ppapi/utility/completion_callback_factory.h"
15 15
16 #ifdef SendMessage 16 #ifdef SendMessage
17 #undef SendMessage 17 #undef SendMessage
18 #endif 18 #endif
19 19
20 namespace pp { 20 namespace pp {
21 21
22 class WebSocketAPI::Implement : public WebSocket { 22 class WebSocketAPI::Implement : public WebSocket {
23 public: 23 public:
24 Implement(Instance* instance, WebSocketAPI* api) 24 Implement(Instance* instance, WebSocketAPI* api)
25 : WebSocket(instance), 25 : WebSocket(instance),
26 api_(api), 26 api_(api),
27 callback_factory_(PP_ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 27 callback_factory_(this) {
28 } 28 }
29 29
30 virtual ~Implement() {} 30 virtual ~Implement() {}
31 31
32 int32_t Connect(const Var& url, const Var protocols[], 32 int32_t Connect(const Var& url, const Var protocols[],
33 uint32_t protocol_count) { 33 uint32_t protocol_count) {
34 CompletionCallback callback = 34 CompletionCallback callback =
35 callback_factory_.NewOptionalCallback(&Implement::DidConnect); 35 callback_factory_.NewOptionalCallback(&Implement::DidConnect);
36 int32_t result = 36 int32_t result =
37 WebSocket::Connect(url, protocols, protocol_count, callback); 37 WebSocket::Connect(url, protocols, protocol_count, callback);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 api_->WebSocketDidClose(was_clean, GetCloseCode(), GetCloseReason()); 97 api_->WebSocketDidClose(was_clean, GetCloseCode(), GetCloseReason());
98 } 98 }
99 99
100 private: 100 private:
101 WebSocketAPI* api_; 101 WebSocketAPI* api_;
102 CompletionCallbackFactory<Implement> callback_factory_; 102 CompletionCallbackFactory<Implement> callback_factory_;
103 Var receive_message_var_; 103 Var receive_message_var_;
104 }; 104 };
105 105
106 WebSocketAPI::WebSocketAPI(Instance* instance) 106 WebSocketAPI::WebSocketAPI(Instance* instance)
107 : impl_(new Implement(instance, PP_ALLOW_THIS_IN_INITIALIZER_LIST(this))) { 107 : impl_(new Implement(instance, this)) {
108 } 108 }
109 109
110 WebSocketAPI::~WebSocketAPI() { 110 WebSocketAPI::~WebSocketAPI() {
111 delete impl_; 111 delete impl_;
112 } 112 }
113 113
114 int32_t WebSocketAPI::Connect(const Var& url, const Var protocols[], 114 int32_t WebSocketAPI::Connect(const Var& url, const Var protocols[],
115 uint32_t protocol_count) { 115 uint32_t protocol_count) {
116 return impl_->Connect(url, protocols, protocol_count); 116 return impl_->Connect(url, protocols, protocol_count);
117 } 117 }
(...skipping 20 matching lines...) Expand all
138 138
139 PP_WebSocketReadyState WebSocketAPI::GetReadyState() { 139 PP_WebSocketReadyState WebSocketAPI::GetReadyState() {
140 return impl_->GetReadyState(); 140 return impl_->GetReadyState();
141 } 141 }
142 142
143 Var WebSocketAPI::GetURL() { 143 Var WebSocketAPI::GetURL() {
144 return impl_->GetURL(); 144 return impl_->GetURL();
145 } 145 }
146 146
147 } // namespace pp 147 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/tests/test_message_loop.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698