Reduce delay when showing feedback.
Move the toDataURL operation of the canvas containing the screenshot to after we show the feedback page. This will significantly increase the response time from when a user requests feedback to the time that the feedback window is shown. R=xiyuan@chromium.org BUG=308414 Review URL: https://codereview.chromium.org/61153007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234660 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
chrome/browser/resources/feedback/js
@@ -235,13 +235,18 @@ function initialize() {
|
||||
if (feedbackInfo.pageUrl)
|
||||
$('page-url-text').value = feedbackInfo.pageUrl;
|
||||
|
||||
takeScreenshot(function(screenshotDataUrl) {
|
||||
$('screenshot-image').src = screenshotDataUrl;
|
||||
feedbackInfo.screenshot = dataUrlToBlob(screenshotDataUrl);
|
||||
takeScreenshot(function(screenshotCanvas) {
|
||||
// TODO(rkc): Remove logging once crbug.com/284662 is closed.
|
||||
console.log('FEEDBACK_DEBUG: Taken screenshot. Showing window.');
|
||||
|
||||
// We've taken our screenshot, show the feedback page without any
|
||||
// further delay.
|
||||
resizeAppWindow();
|
||||
chrome.app.window.current().show();
|
||||
|
||||
var screenshotDataUrl = screenshotCanvas.toDataURL('image/png');
|
||||
$('screenshot-image').src = screenshotDataUrl;
|
||||
feedbackInfo.screenshot = dataUrlToBlob(screenshotDataUrl);
|
||||
});
|
||||
|
||||
chrome.feedbackPrivate.getUserEmail(function(email) {
|
||||
|
@@ -4,8 +4,8 @@
|
||||
|
||||
/**
|
||||
* Function to take the screenshot of the current screen.
|
||||
* @param {function(string)} callback Callback for returning the data URL to the
|
||||
* screenshot.
|
||||
* @param {function(HTMLCanvasElement)} callback Callback for returning the
|
||||
* canvas with the screenshot on it.
|
||||
*/
|
||||
function takeScreenshot(callback) {
|
||||
var screenshotStream = null;
|
||||
@@ -25,7 +25,7 @@ function takeScreenshot(callback) {
|
||||
screenshotStream.stop();
|
||||
screenshotStream = null;
|
||||
|
||||
callback(canvas.toDataURL('image/png'));
|
||||
callback(canvas);
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
Reference in New Issue
Block a user