| OLD | NEW |
| 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 #import "ios/chrome/browser/crash_report/crash_report_multi_parameter.h" | 5 #import "ios/chrome/browser/crash_report/crash_report_multi_parameter.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #import "ios/chrome/browser/crash_report/breakpad_helper.h" | 14 #import "ios/chrome/browser/crash_report/breakpad_helper.h" |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 // Maximum size of a breakpad parameter. he length of the dictionary serialized | 17 // Maximum size of a breakpad parameter. he length of the dictionary serialized |
| 17 // into JSON cannot exceed this length. See declaration in (BreakPad.h) for | 18 // into JSON cannot exceed this length. See declaration in (BreakPad.h) for |
| 18 // details. | 19 // details. |
| 19 const int kMaximumBreakpadValueSize = 255; | 20 const int kMaximumBreakpadValueSize = 255; |
| 20 } | 21 } |
| 21 | 22 |
| 22 @implementation CrashReportMultiParameter { | 23 @implementation CrashReportMultiParameter { |
| 23 base::scoped_nsobject<NSString> crashReportKey_; | 24 base::scoped_nsobject<NSString> crashReportKey_; |
| 24 scoped_ptr<base::DictionaryValue> dictionary_; | 25 std::unique_ptr<base::DictionaryValue> dictionary_; |
| 25 } | 26 } |
| 26 | 27 |
| 27 - (instancetype)init { | 28 - (instancetype)init { |
| 28 NOTREACHED(); | 29 NOTREACHED(); |
| 29 return nil; | 30 return nil; |
| 30 } | 31 } |
| 31 | 32 |
| 32 - (instancetype)initWithKey:(NSString*)key { | 33 - (instancetype)initWithKey:(NSString*)key { |
| 33 if ((self = [super init])) { | 34 if ((self = [super init])) { |
| 34 DCHECK([key length] && ([key length] <= kMaximumBreakpadValueSize)); | 35 DCHECK([key length] && ([key length] <= kMaximumBreakpadValueSize)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return; | 81 return; |
| 81 } | 82 } |
| 82 breakpad_helper::AddReportParameter( | 83 breakpad_helper::AddReportParameter( |
| 83 crashReportKey_, | 84 crashReportKey_, |
| 84 [NSString stringWithCString:stateAsJson.c_str() | 85 [NSString stringWithCString:stateAsJson.c_str() |
| 85 encoding:[NSString defaultCStringEncoding]], | 86 encoding:[NSString defaultCStringEncoding]], |
| 86 true); | 87 true); |
| 87 } | 88 } |
| 88 | 89 |
| 89 @end | 90 @end |
| OLD | NEW |