Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2411363002: Add timer to OffscreenCanvas's commit API (Closed)
Patch Set: forgot two breaks Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 // no HTMLCanvas associated, thrown InvalidStateError 694 // no HTMLCanvas associated, thrown InvalidStateError
695 if (getOffscreenCanvas()->getAssociatedCanvasId() == -1) { 695 if (getOffscreenCanvas()->getAssociatedCanvasId() == -1) {
696 exceptionState.throwDOMException(InvalidStateError, 696 exceptionState.throwDOMException(InvalidStateError,
697 "Commit() was called on a context whose " 697 "Commit() was called on a context whose "
698 "OffscreenCanvas is not associated with a " 698 "OffscreenCanvas is not associated with a "
699 "canvas element."); 699 "canvas element.");
700 return; 700 return;
701 } 701 }
702 if (!drawingBuffer()) 702 if (!drawingBuffer())
703 return; 703 return;
704 double commitStartTime = WTF::monotonicallyIncreasingTime();
704 // TODO(crbug.com/646864): Make commit() work correctly with 705 // TODO(crbug.com/646864): Make commit() work correctly with
705 // { preserveDrawingBuffer : true }. 706 // { preserveDrawingBuffer : true }.
706 getOffscreenCanvas()->getOrCreateFrameDispatcher()->dispatchFrame( 707 getOffscreenCanvas()->getOrCreateFrameDispatcher()->dispatchFrame(
707 std::move(drawingBuffer()->transferToStaticBitmapImage()), 708 std::move(drawingBuffer()->transferToStaticBitmapImage()),
709 commitStartTime,
708 drawingBuffer()->contextProvider()->isSoftwareRendering()); 710 drawingBuffer()->contextProvider()->isSoftwareRendering());
709 } 711 }
710 712
711 PassRefPtr<Image> WebGLRenderingContextBase::getImage( 713 PassRefPtr<Image> WebGLRenderingContextBase::getImage(
712 AccelerationHint hint, 714 AccelerationHint hint,
713 SnapshotReason reason) const { 715 SnapshotReason reason) const {
714 if (!drawingBuffer()) 716 if (!drawingBuffer())
715 return nullptr; 717 return nullptr;
716 718
717 drawingBuffer()->commit(); 719 drawingBuffer()->commit();
(...skipping 6811 matching lines...) Expand 10 before | Expand all | Expand 10 after
7529 7531
7530 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7532 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7531 HTMLCanvasElementOrOffscreenCanvas& result) const { 7533 HTMLCanvasElementOrOffscreenCanvas& result) const {
7532 if (canvas()) 7534 if (canvas())
7533 result.setHTMLCanvasElement(canvas()); 7535 result.setHTMLCanvasElement(canvas());
7534 else 7536 else
7535 result.setOffscreenCanvas(getOffscreenCanvas()); 7537 result.setOffscreenCanvas(getOffscreenCanvas());
7536 } 7538 }
7537 7539
7538 } // namespace blink 7540 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698