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

Side by Side Diff: ppapi/shared_impl/socket_option_data.cc

Issue 16959005: Implement PPB_UDPSocket_Dev: part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/shared_impl/socket_option_data.h ('k') | ppapi/tests/test_udp_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/shared_impl/socket_option_data.h"
6
7 namespace ppapi {
8
9 SocketOptionData::SocketOptionData() : type_(TYPE_INVALID), value_(0) {
10 }
11
12 SocketOptionData::~SocketOptionData() {
13 }
14
15 SocketOptionData::Type SocketOptionData::GetType() const {
16 return type_;
17 }
18
19 bool SocketOptionData::GetBool(bool* out_value) const {
20 if (!out_value || type_ != TYPE_BOOL)
21 return false;
22 *out_value = value_ != 0;
23 return true;
24 }
25
26 bool SocketOptionData::GetInt32(int32_t* out_value) const {
27 if (!out_value || type_ != TYPE_INT32)
28 return false;
29 *out_value = value_;
30 return true;
31 }
32
33 void SocketOptionData::SetBool(bool value) {
34 type_ = TYPE_BOOL;
35 value_ = value ? 1 : 0;
36 }
37
38 void SocketOptionData::SetInt32(int32_t value) {
39 type_ = TYPE_INT32;
40 value_ = value;
41 }
42
43 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/socket_option_data.h ('k') | ppapi/tests/test_udp_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698