-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a web API clearCrashpadDatabase #4790
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see this getting traction.
std::vector<char> cache_dir(kSbFileMaxPath + 1, 0); | ||
SbSystemGetPath(kSbSystemPathCacheDirectory, cache_dir.data(), | ||
kSbFileMaxPath); | ||
base::FilePath crashpad_db_dir = | ||
base::FilePath(cache_dir.data()).Append(kCrashpadDBName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use std::string?
std::string cache_folder(kSbFileMaxPath, 0);
SbSystemGetPath(..., cache_folder.data(),..);
base::FilePath crashpad_db_folder(cache_folder);
crashpad_db_folder.Append(kCrashpadDBName);
Try to avoid using acronyms or shortenings: s/dir/directory/ or s/dir/folder/. Maybe also expand s/db/database/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Same as above. I followed the existing style for consistency, including the name "cache_dir". If all reviewers think they should be fixed all together, I'll make another PR.
std::vector<char> cache_dir(kSbFileMaxPath + 1, 0); | ||
SbSystemGetPath(kSbSystemPathCacheDirectory, cache_dir.data(), | ||
kSbFileMaxPath); | ||
base::FilePath crashpad_db_dir = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declaring and initializing crashpad_db_dir
in one line: I don't see a strong reason to have it the way it's presented vs the suggested alternative below unless it's to make this variable const.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment. There're 4 existing references of initializing file path and appending another segment in h5vcc_storage.cc. I followed the existing style for consistency. I don't see which way is significantly better or more correct. I prefer to make this PR focused on adding the API, rather than fixing existing styles. I don't think it's absolutely necessary to fix the styles of this file at the moment, as this style is present in many files in the code base. What's the point of fixing one file without fixing all the files? IMO it's not a priority for the team at the moment.
I'll submit this PR as is since all reviewers approved. But if all the reviewers think it's absolutely necessary to fix this style in this file, I'll make another PR to fix this one and the other 4 references, just to make this PR focused. @y4vor @hlwarriner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with keeping the existing style. Thanks for checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one comment but otherwise lgtm! Thanks for taking this.
@@ -31,4 +31,6 @@ interface H5vccStorage { | |||
void clearCache(); | |||
void clearCacheOfType(octet type_index); | |||
void clearServiceWorkerCache(); | |||
|
|||
void clearCrashpadDatabase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be a good idea to just add a quick comment explaining that this API is only meant to be called from tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This API will be used in crashpad handler test to clear up the previous states to work around the upload throttling that causes the tests to fail frequently for partner certification. b/332895679 Change-Id: I0b104a64dbd156de6df817800c972042e810e654
This API will be used in crashpad handler test to clear up the previous states to work around the upload throttling that causes the tests to fail frequently for partner certification.
Verified on Linux: Crashpad DB is purged after caling the API. After app restarts, crash upload works as expected.
b/332895679
Change-Id: I0b104a64dbd156de6df817800c972042e810e654