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

Side by Side Diff: extensions/renderer/extensions_render_frame_observer.cc

Issue 2356253006: Make SplitStringUsingSubstr have consistent args. (Closed)
Patch Set: Created 4 years, 3 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 "extensions/renderer/extensions_render_frame_observer.h" 5 #include "extensions/renderer/extensions_render_frame_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 22 matching lines...) Expand all
33 StackTrace GetStackTraceFromMessage(base::string16* message, 33 StackTrace GetStackTraceFromMessage(base::string16* message,
34 const base::string16& source, 34 const base::string16& source,
35 const base::string16& stack_trace, 35 const base::string16& stack_trace,
36 int32_t line_number) { 36 int32_t line_number) {
37 StackTrace result; 37 StackTrace result;
38 std::vector<base::string16> pieces; 38 std::vector<base::string16> pieces;
39 size_t index = 0; 39 size_t index = 0;
40 40
41 if (message->find(base::UTF8ToUTF16(kStackFrameDelimiter)) != 41 if (message->find(base::UTF8ToUTF16(kStackFrameDelimiter)) !=
42 base::string16::npos) { 42 base::string16::npos) {
43 base::SplitStringUsingSubstr(*message, 43 pieces = base::SplitStringUsingSubstr(
44 base::UTF8ToUTF16(kStackFrameDelimiter), 44 *message, base::UTF8ToUTF16(kStackFrameDelimiter),
45 &pieces); 45 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
46 *message = pieces[0]; 46 *message = pieces[0];
47 index = 1; 47 index = 1;
48 } else if (!stack_trace.empty()) { 48 } else if (!stack_trace.empty()) {
49 base::SplitStringUsingSubstr(stack_trace, 49 pieces = base::SplitStringUsingSubstr(
50 base::UTF8ToUTF16(kStackFrameDelimiter), 50 stack_trace, base::UTF8ToUTF16(kStackFrameDelimiter),
51 &pieces); 51 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
52 } 52 }
53 53
54 // If we got a stack trace, parse each frame from the text. 54 // If we got a stack trace, parse each frame from the text.
55 if (index < pieces.size()) { 55 if (index < pieces.size()) {
56 for (; index < pieces.size(); ++index) { 56 for (; index < pieces.size(); ++index) {
57 std::unique_ptr<StackFrame> frame = 57 std::unique_ptr<StackFrame> frame =
58 StackFrame::CreateFromText(pieces[index]); 58 StackFrame::CreateFromText(pieces[index]);
59 if (frame.get()) 59 if (frame.get())
60 result.push_back(*frame); 60 result.push_back(*frame);
61 } 61 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 line_number); 96 line_number);
97 Send(new ExtensionHostMsg_DetailedConsoleMessageAdded( 97 Send(new ExtensionHostMsg_DetailedConsoleMessageAdded(
98 routing_id(), trimmed_message, source, stack_trace, severity_level)); 98 routing_id(), trimmed_message, source, stack_trace, severity_level));
99 } 99 }
100 100
101 void ExtensionsRenderFrameObserver::OnDestruct() { 101 void ExtensionsRenderFrameObserver::OnDestruct() {
102 delete this; 102 delete this;
103 } 103 }
104 104
105 } // namespace extensions 105 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/chrome_content_client_unittest.cc ('k') | net/ftp/ftp_directory_listing_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698