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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8ValueCache.cpp

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: fixed dcheck build error Created 3 years, 8 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return; 126 return;
127 } 127 }
128 128
129 return_value.Set( 129 return_value.Set(
130 CreateStringAndInsertIntoCache(return_value.GetIsolate(), string_impl)); 130 CreateStringAndInsertIntoCache(return_value.GetIsolate(), string_impl));
131 } 131 }
132 132
133 v8::Local<v8::String> StringCache::CreateStringAndInsertIntoCache( 133 v8::Local<v8::String> StringCache::CreateStringAndInsertIntoCache(
134 v8::Isolate* isolate, 134 v8::Isolate* isolate,
135 StringImpl* string_impl) { 135 StringImpl* string_impl) {
136 ASSERT(!string_cache_.Contains(string_impl)); 136 DCHECK(!string_cache_.Contains(string_impl));
137 ASSERT(string_impl->length()); 137 DCHECK(string_impl->length());
138 138
139 v8::Local<v8::String> new_string = 139 v8::Local<v8::String> new_string =
140 MakeExternalString(isolate, String(string_impl)); 140 MakeExternalString(isolate, String(string_impl));
141 ASSERT(!new_string.IsEmpty()); 141 DCHECK(!new_string.IsEmpty());
142 ASSERT(new_string->Length()); 142 DCHECK(new_string->Length());
143 143
144 v8::UniquePersistent<v8::String> wrapper(isolate, new_string); 144 v8::UniquePersistent<v8::String> wrapper(isolate, new_string);
145 145
146 string_impl->Ref(); 146 string_impl->Ref();
147 wrapper.MarkIndependent(); 147 wrapper.MarkIndependent();
148 string_cache_.Set(string_impl, std::move(wrapper), &last_v8_string_); 148 string_cache_.Set(string_impl, std::move(wrapper), &last_v8_string_);
149 last_string_impl_ = string_impl; 149 last_string_impl_ = string_impl;
150 150
151 return new_string; 151 return new_string;
152 } 152 }
153 153
154 void StringCache::InvalidateLastString() { 154 void StringCache::InvalidateLastString() {
155 last_string_impl_ = nullptr; 155 last_string_impl_ = nullptr;
156 last_v8_string_.Reset(); 156 last_v8_string_.Reset();
157 } 157 }
158 158
159 } // namespace blink 159 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698