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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp

Issue 2199943004: [DevTools] Rename V8Debugger to V8Inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/v8_inspector/V8StringUtil.h" 5 #include "platform/v8_inspector/V8StringUtil.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/v8_inspector/V8DebuggerImpl.h" 8 #include "platform/v8_inspector/V8InspectorImpl.h"
9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
10 #include "platform/v8_inspector/V8Regex.h" 10 #include "platform/v8_inspector/V8Regex.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 namespace { 14 namespace {
15 15
16 String16 findMagicComment(const String16& content, const String16& name, bool mu ltiline, bool* deprecated) 16 String16 findMagicComment(const String16& content, const String16& name, bool mu ltiline, bool* deprecated)
17 { 17 {
18 DCHECK(name.find("=") == kNotFound); 18 DCHECK(name.find("=") == kNotFound);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 std::unique_ptr<protocol::Debugger::SearchMatch> buildObjectForSearchMatch(int l ineNumber, const String16& lineContent) 138 std::unique_ptr<protocol::Debugger::SearchMatch> buildObjectForSearchMatch(int l ineNumber, const String16& lineContent)
139 { 139 {
140 return protocol::Debugger::SearchMatch::create() 140 return protocol::Debugger::SearchMatch::create()
141 .setLineNumber(lineNumber) 141 .setLineNumber(lineNumber)
142 .setLineContent(lineContent) 142 .setLineContent(lineContent)
143 .build(); 143 .build();
144 } 144 }
145 145
146 std::unique_ptr<V8Regex> createSearchRegex(V8DebuggerImpl* debugger, const Strin g16& query, bool caseSensitive, bool isRegex) 146 std::unique_ptr<V8Regex> createSearchRegex(V8InspectorImpl* inspector, const Str ing16& query, bool caseSensitive, bool isRegex)
147 { 147 {
148 String16 regexSource = isRegex ? query : createSearchRegexSource(query); 148 String16 regexSource = isRegex ? query : createSearchRegexSource(query);
149 return wrapUnique(new V8Regex(debugger, regexSource, caseSensitive)); 149 return wrapUnique(new V8Regex(inspector, regexSource, caseSensitive));
150 } 150 }
151 151
152 } // namespace 152 } // namespace
153 153
154 v8::Local<v8::String> toV8String(v8::Isolate* isolate, const String16& string) 154 v8::Local<v8::String> toV8String(v8::Isolate* isolate, const String16& string)
155 { 155 {
156 if (string.isEmpty()) 156 if (string.isEmpty())
157 return v8::String::Empty(isolate); 157 return v8::String::Empty(isolate);
158 return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*> (string.characters16()), v8::NewStringType::kNormal, string.length()).ToLocalChe cked(); 158 return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*> (string.characters16()), v8::NewStringType::kNormal, string.length()).ToLocalChe cked();
159 } 159 }
(...skipping 16 matching lines...) Expand all
176 176
177 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value> value) 177 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value> value)
178 { 178 {
179 if (value.IsEmpty() || !value->IsString()) 179 if (value.IsEmpty() || !value->IsString())
180 return String16(); 180 return String16();
181 return toProtocolString(value.As<v8::String>()); 181 return toProtocolString(value.As<v8::String>());
182 } 182 }
183 183
184 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> searchInTextByLine sImpl(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex) 184 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> searchInTextByLine sImpl(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex)
185 { 185 {
186 std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSe ssionImpl*>(session)->debugger(), query, caseSensitive, isRegex); 186 std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSe ssionImpl*>(session)->inspector(), query, caseSensitive, isRegex);
187 std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(* regex.get(), text); 187 std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(* regex.get(), text);
188 188
189 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result; 189 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result;
190 for (const auto& match : matches) 190 for (const auto& match : matches)
191 result.push_back(buildObjectForSearchMatch(match.first, match.second)); 191 result.push_back(buildObjectForSearchMatch(match.first, match.second));
192 return result; 192 return result;
193 } 193 }
194 194
195 String16 findSourceURL(const String16& content, bool multiline, bool* deprecated ) 195 String16 findSourceURL(const String16& content, bool multiline, bool* deprecated )
196 { 196 {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 return nullptr; 269 return nullptr;
270 jsonObject->setValue(toProtocolString(propertyName), std::move(prope rtyValue)); 270 jsonObject->setValue(toProtocolString(propertyName), std::move(prope rtyValue));
271 } 271 }
272 return std::move(jsonObject); 272 return std::move(jsonObject);
273 } 273 }
274 NOTREACHED(); 274 NOTREACHED();
275 return nullptr; 275 return nullptr;
276 } 276 }
277 277
278 } // namespace blink 278 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698