diff options
author | ricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 11:55:10 +0000 |
---|---|---|
committer | ricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 11:55:10 +0000 |
commit | 0553072d237ad2b977e948591de3f87eee536a9c (patch) | |
tree | 58b462d22b2342db07c041ac8abaf061e671d1e5 /content/browser/devtools/renderer_overrides_handler.cc | |
parent | 9377d2ad77c6d7ee0190c90544eaed0ff0c7fc9c (diff) | |
download | chromium_src-0553072d237ad2b977e948591de3f87eee536a9c.zip chromium_src-0553072d237ad2b977e948591de3f87eee536a9c.tar.gz chromium_src-0553072d237ad2b977e948591de3f87eee536a9c.tar.bz2 |
The comment in base64.h implies that base::Base64Encode() can return false, but
this cannot happen in practice. Fix the comment.
The implementation of Base64Encode() attempts to check for the return value
MODP_B64_ERROR as a failure, but modp_b64_encode() cannot return this
value. Remove the check.
Remove unneeded integer cast.
Change the return type to void.
BUG=323357
TEST=base_unittests, compile all
TBR=jochen@chromium.org,miket@chromium.org,joi@chromium.org,akalin@chromium.org,sergeyu@chromium.org
Review URL: https://codereview.chromium.org/86913002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/devtools/renderer_overrides_handler.cc')
-rw-r--r-- | content/browser/devtools/renderer_overrides_handler.cc | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/content/browser/devtools/renderer_overrides_handler.cc b/content/browser/devtools/renderer_overrides_handler.cc index 1bd487f..4901f34 100644 --- a/content/browser/devtools/renderer_overrides_handler.cc +++ b/content/browser/devtools/renderer_overrides_handler.cc @@ -443,16 +443,13 @@ RendererOverridesHandler::PageCaptureScreenshot( &png, gfx::Rect(snapshot_size))) { std::string base64_data; - bool success = base::Base64Encode( + base::Base64Encode( base::StringPiece(reinterpret_cast<char*>(&*png.begin()), png.size()), &base64_data); - if (success) { - base::DictionaryValue* result = new base::DictionaryValue(); - result->SetString( - devtools::Page::captureScreenshot::kResponseData, base64_data); - return command->SuccessResponse(result); - } - return command->InternalErrorResponse("Unable to base64encode screenshot"); + base::DictionaryValue* result = new base::DictionaryValue(); + result->SetString( + devtools::Page::captureScreenshot::kResponseData, base64_data); + return command->SuccessResponse(result); } // Fallback to copying from compositing surface. @@ -553,16 +550,9 @@ void RendererOverridesHandler::ScreenshotCaptured( } std::string base_64_data; - if (!base::Base64Encode(base::StringPiece( - reinterpret_cast<char*>(&data[0]), - data.size()), - &base_64_data)) { - if (command) { - SendAsyncResponse( - command->InternalErrorResponse("Unable to base64 encode")); - } - return; - } + base::Base64Encode( + base::StringPiece(reinterpret_cast<char*>(&data[0]), data.size()), + &base_64_data); base::DictionaryValue* response = new base::DictionaryValue(); response->SetString(devtools::Page::screencastFrame::kParamData, |