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

Side by Side Diff: content/common/android/gin_java_bridge_value.cc

Issue 649533003: C++11 declares a type safe null pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Presubmit errors Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/common/android/gin_java_bridge_value.h" 5 #include "content/common/android/gin_java_bridge_value.h"
6 6
7 namespace content { 7 namespace content {
8 8
9 namespace { 9 namespace {
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 header->type >= TYPE_FIRST_VALUE && header->type < TYPE_LAST_VALUE); 70 header->type >= TYPE_FIRST_VALUE && header->type < TYPE_LAST_VALUE);
71 } 71 }
72 72
73 // static 73 // static
74 scoped_ptr<const GinJavaBridgeValue> GinJavaBridgeValue::FromValue( 74 scoped_ptr<const GinJavaBridgeValue> GinJavaBridgeValue::FromValue(
75 const base::Value* value) { 75 const base::Value* value) {
76 return scoped_ptr<const GinJavaBridgeValue>( 76 return scoped_ptr<const GinJavaBridgeValue>(
77 value->IsType(base::Value::TYPE_BINARY) 77 value->IsType(base::Value::TYPE_BINARY)
78 ? new GinJavaBridgeValue( 78 ? new GinJavaBridgeValue(
79 reinterpret_cast<const base::BinaryValue*>(value)) 79 reinterpret_cast<const base::BinaryValue*>(value))
80 : NULL); 80 : nullptr);
81 } 81 }
82 82
83 GinJavaBridgeValue::Type GinJavaBridgeValue::GetType() const { 83 GinJavaBridgeValue::Type GinJavaBridgeValue::GetType() const {
84 const Header* header = pickle_.headerT<Header>(); 84 const Header* header = pickle_.headerT<Header>();
85 DCHECK(header->type >= TYPE_FIRST_VALUE && header->type < TYPE_LAST_VALUE); 85 DCHECK(header->type >= TYPE_FIRST_VALUE && header->type < TYPE_LAST_VALUE);
86 return static_cast<Type>(header->type); 86 return static_cast<Type>(header->type);
87 } 87 }
88 88
89 bool GinJavaBridgeValue::IsType(Type type) const { 89 bool GinJavaBridgeValue::IsType(Type type) const {
90 return GetType() == type; 90 return GetType() == type;
(...skipping 28 matching lines...) Expand all
119 : pickle_(value->GetBuffer(), value->GetSize()) { 119 : pickle_(value->GetBuffer(), value->GetSize()) {
120 DCHECK(ContainsGinJavaBridgeValue(value)); 120 DCHECK(ContainsGinJavaBridgeValue(value));
121 } 121 }
122 122
123 base::BinaryValue* GinJavaBridgeValue::SerializeToBinaryValue() { 123 base::BinaryValue* GinJavaBridgeValue::SerializeToBinaryValue() {
124 return base::BinaryValue::CreateWithCopiedBuffer( 124 return base::BinaryValue::CreateWithCopiedBuffer(
125 reinterpret_cast<const char*>(pickle_.data()), pickle_.size()); 125 reinterpret_cast<const char*>(pickle_.data()), pickle_.size());
126 } 126 }
127 127
128 } // namespace content 128 } // namespace content
OLDNEW
« no previous file with comments | « content/common/android/address_parser.cc ('k') | content/common/android/surface_texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698