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

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

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 return result; 147 return result;
148 } 148 }
149 149
150 v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Object( 150 v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Object(
151 const DictionaryValue* val) const { 151 const DictionaryValue* val) const {
152 v8::Handle<v8::Object> result(v8::Object::New()); 152 v8::Handle<v8::Object> result(v8::Object::New());
153 153
154 for (DictionaryValue::key_iterator iter = val->begin_keys(); 154 for (DictionaryValue::key_iterator iter = val->begin_keys();
155 iter != val->end_keys(); ++iter) { 155 iter != val->end_keys(); ++iter) {
156 Value* child = NULL; 156 const Value* child = NULL;
157 CHECK(val->GetWithoutPathExpansion(*iter, &child)); 157 CHECK(val->GetWithoutPathExpansion(*iter, &child));
158 158
159 const std::string& key = *iter; 159 const std::string& key = *iter;
160 v8::Handle<v8::Value> child_v8 = ToV8ValueImpl(child); 160 v8::Handle<v8::Value> child_v8 = ToV8ValueImpl(child);
161 CHECK(!child_v8.IsEmpty()); 161 CHECK(!child_v8.IsEmpty());
162 162
163 v8::TryCatch try_catch; 163 v8::TryCatch try_catch;
164 result->Set(v8::String::New(key.c_str(), key.length()), child_v8); 164 result->Set(v8::String::New(key.c_str(), key.length()), child_v8);
165 if (try_catch.HasCaught()) { 165 if (try_catch.HasCaught()) {
166 LOG(ERROR) << "Setter for property " << key.c_str() << " threw an " 166 LOG(ERROR) << "Setter for property " << key.c_str() << " threw an "
(...skipping 183 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