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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/socket_option_data.cc
diff --git a/ppapi/shared_impl/socket_option_data.cc b/ppapi/shared_impl/socket_option_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d0e359a095eee994633d45493eb3665764d01cdb
--- /dev/null
+++ b/ppapi/shared_impl/socket_option_data.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/shared_impl/socket_option_data.h"
+
+namespace ppapi {
+
+SocketOptionData::SocketOptionData() : type_(TYPE_INVALID), value_(0) {
+}
+
+SocketOptionData::~SocketOptionData() {
+}
+
+SocketOptionData::Type SocketOptionData::GetType() const {
+ return type_;
+}
+
+bool SocketOptionData::GetBool(bool* out_value) const {
+ if (!out_value || type_ != TYPE_BOOL)
+ return false;
+ *out_value = value_ != 0;
+ return true;
+}
+
+bool SocketOptionData::GetInt32(int32_t* out_value) const {
+ if (!out_value || type_ != TYPE_INT32)
+ return false;
+ *out_value = value_;
+ return true;
+}
+
+void SocketOptionData::SetBool(bool value) {
+ type_ = TYPE_BOOL;
+ value_ = value ? 1 : 0;
+}
+
+void SocketOptionData::SetInt32(int32_t value) {
+ type_ = TYPE_INT32;
+ value_ = value;
+}
+
+} // namespace ppapi
« 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