MCPcopy Create free account
hub / github.com/chromium/crashpad / Initialize

Method Initialize

client/ios_handler/in_process_handler.cc:70–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70bool InProcessHandler::Initialize(
71 const base::FilePath& database,
72 const std::string& url,
73 const std::map<std::string, std::string>& annotations,
74 ProcessPendingReportsObservationCallback callback) {
75 INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
76 annotations_ = annotations;
77 database_ = CrashReportDatabase::Initialize(database);
78 if (!database_) {
79 return false;
80 }
81 bundle_identifier_and_seperator_ =
82 system_data_.BundleIdentifier() + kBundleSeperator;
83
84 if (!url.empty()) {
85 // TODO(scottmg): options.rate_limit should be removed when we have a
86 // configurable database setting to control upload limiting.
87 // See https://crashpad.chromium.org/bug/23.
88 CrashReportUploadThread::Options upload_thread_options;
89 upload_thread_options.rate_limit = false;
90 upload_thread_options.upload_gzip = true;
91 upload_thread_options.watch_pending_reports = true;
92 upload_thread_options.identify_client_via_url = true;
93
94 upload_thread_.reset(new CrashReportUploadThread(
95 database_.get(), url, upload_thread_options, callback));
96 }
97
98 if (!CreateDirectory(database))
99 return false;
100 static constexpr char kPendingSerializediOSDump[] =
101 "pending-serialized-ios-dump";
102 base_dir_ = database.Append(kPendingSerializediOSDump);
103 if (!CreateDirectory(base_dir_))
104 return false;
105
106 bool is_app_extension = system_data_.IsExtension();
107 prune_thread_.reset(new PruneIntermediateDumpsAndCrashReportsThread(
108 database_.get(),
109 PruneCondition::GetDefault(),
110 base_dir_,
111 bundle_identifier_and_seperator_,
112 is_app_extension));
113 if (is_app_extension || system_data_.IsApplicationActive())
114 prune_thread_->Start();
115
116 if (!is_app_extension) {
117 system_data_.SetActiveApplicationCallback([this](bool active) {
118 dispatch_async(
119 dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
120 UpdatePruneAndUploadThreads(active,
121 UploadBehavior::kUploadWhenAppIsActive);
122 });
123 });
124 }
125
126 base::FilePath cached_writer_path = NewLockedFilePath();
127 cached_writer_ = CreateWriterWithPath(cached_writer_path);

Callers 2

TEST_FFunction · 0.45
SetUpMethod · 0.45

Calls 10

AppendMethod · 0.80
IsExtensionMethod · 0.80
IsApplicationActiveMethod · 0.80
CreateDirectoryFunction · 0.70
emptyMethod · 0.45
resetMethod · 0.45
getMethod · 0.45
StartMethod · 0.45
valueMethod · 0.45

Tested by 2

TEST_FFunction · 0.36
SetUpMethod · 0.36