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

Side by Side Diff: content/renderer/v8_value_converter_impl.cc

Issue 10837044: Correct const accessors in base/values.(h|cc), Part II (ListValue) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: David's comments Created 8 years, 4 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
« no previous file with comments | « content/browser/speech/google_one_shot_remote_engine.cc ('k') | ipc/ipc_message_utils.cc » ('j') | 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 "content/renderer/v8_value_converter_impl.h" 5 #include "content/renderer/v8_value_converter_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 LOG(ERROR) << "Unexpected value type: " << value->GetType(); 125 LOG(ERROR) << "Unexpected value type: " << value->GetType();
126 return v8::Null(); 126 return v8::Null();
127 } 127 }
128 } 128 }
129 129
130 v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Array( 130 v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Array(
131 const ListValue* val) const { 131 const ListValue* val) const {
132 v8::Handle<v8::Array> result(v8::Array::New(val->GetSize())); 132 v8::Handle<v8::Array> result(v8::Array::New(val->GetSize()));
133 133
134 for (size_t i = 0; i < val->GetSize(); ++i) { 134 for (size_t i = 0; i < val->GetSize(); ++i) {
135 Value* child = NULL; 135 const Value* child = NULL;
136 CHECK(val->Get(i, &child)); 136 CHECK(val->Get(i, &child));
137 137
138 v8::Handle<v8::Value> child_v8 = ToV8ValueImpl(child); 138 v8::Handle<v8::Value> child_v8 = ToV8ValueImpl(child);
139 CHECK(!child_v8.IsEmpty()); 139 CHECK(!child_v8.IsEmpty());
140 140
141 v8::TryCatch try_catch; 141 v8::TryCatch try_catch;
142 result->Set(static_cast<uint32>(i), child_v8); 142 result->Set(static_cast<uint32>(i), child_v8);
143 if (try_catch.HasCaught()) 143 if (try_catch.HasCaught())
144 LOG(ERROR) << "Setter for index " << i << " threw an exception."; 144 LOG(ERROR) << "Setter for index " << i << " threw an exception.";
145 } 145 }
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // We can avoid all bugs related to this by stripping null. 350 // We can avoid all bugs related to this by stripping null.
351 if (strip_null_from_objects_ && child->IsType(Value::TYPE_NULL)) 351 if (strip_null_from_objects_ && child->IsType(Value::TYPE_NULL))
352 continue; 352 continue;
353 353
354 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), 354 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()),
355 child.release()); 355 child.release());
356 } 356 }
357 357
358 return result.release(); 358 return result.release();
359 } 359 }
OLDNEW
« no previous file with comments | « content/browser/speech/google_one_shot_remote_engine.cc ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698