| Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
|
| diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
|
| index 4ef70aea639ff6d8f275460b47e6eb61deceba23..e30d52b1000e63c35fb4ae501d0e9635bf7146e8 100644
|
| --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
|
| +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
|
| @@ -167,9 +167,9 @@ void CanvasRenderingContext2D::ValidateStateStack() const {
|
| }
|
|
|
| bool CanvasRenderingContext2D::IsAccelerated() const {
|
| - if (!canvas()->HasImageBuffer())
|
| + if (!host()->HasImageBuffer())
|
| return false;
|
| - return canvas()->Buffer()->IsAccelerated();
|
| + return host()->GetImageBuffer()->IsAccelerated();
|
| }
|
|
|
| bool CanvasRenderingContext2D::IsComposited() const {
|
| @@ -192,7 +192,7 @@ void CanvasRenderingContext2D::LoseContext(LostContextMode lost_mode) {
|
| return;
|
| context_lost_mode_ = lost_mode;
|
| if (context_lost_mode_ == kSyntheticLostContext && canvas()) {
|
| - canvas()->DiscardImageBuffer();
|
| + host()->DiscardImageBuffer();
|
| }
|
| dispatch_context_lost_event_timer_.StartOneShot(0, BLINK_FROM_HERE);
|
| }
|
| @@ -202,9 +202,9 @@ void CanvasRenderingContext2D::DidSetSurfaceSize() {
|
| return;
|
| // This code path is for restoring from an eviction
|
| // Restoring from surface failure is handled internally
|
| - DCHECK(context_lost_mode_ != kNotLostContext && !canvas()->HasImageBuffer());
|
| + DCHECK(context_lost_mode_ != kNotLostContext && !host()->HasImageBuffer());
|
|
|
| - if (canvas()->Buffer()) {
|
| + if (host()->GetImageBuffer()) {
|
| if (ContextLostRestoredEventsEnabled()) {
|
| dispatch_context_restored_event_timer_.StartOneShot(0, BLINK_FROM_HERE);
|
| } else {
|
| @@ -250,16 +250,16 @@ void CanvasRenderingContext2D::TryRestoreContextEvent(TimerBase* timer) {
|
| }
|
|
|
| DCHECK(context_lost_mode_ == kRealLostContext);
|
| - if (canvas()->HasImageBuffer() && canvas()->Buffer()->RestoreSurface()) {
|
| + if (host()->HasImageBuffer() && host()->GetImageBuffer()->RestoreSurface()) {
|
| try_restore_context_event_timer_.Stop();
|
| DispatchContextRestoredEvent(nullptr);
|
| }
|
|
|
| if (++try_restore_context_attempt_count_ > kMaxTryRestoreContextAttempts) {
|
| // final attempt: allocate a brand new image buffer instead of restoring
|
| - canvas()->DiscardImageBuffer();
|
| + host()->DiscardImageBuffer();
|
| try_restore_context_event_timer_.Stop();
|
| - if (canvas()->Buffer())
|
| + if (host()->GetImageBuffer())
|
| DispatchContextRestoredEvent(nullptr);
|
| }
|
| }
|
| @@ -368,7 +368,7 @@ void CanvasRenderingContext2D::DidDraw(const SkIRect& dirty_rect) {
|
|
|
| if (ExpensiveCanvasHeuristicParameters::kBlurredShadowsAreExpensive &&
|
| GetState().ShouldDrawShadows() && GetState().ShadowBlur() > 0) {
|
| - ImageBuffer* buffer = canvas()->Buffer();
|
| + ImageBuffer* buffer = host()->GetImageBuffer();
|
| if (buffer)
|
| buffer->SetHasExpensiveOp();
|
| }
|
| @@ -602,11 +602,11 @@ int CanvasRenderingContext2D::Height() const {
|
| }
|
|
|
| bool CanvasRenderingContext2D::HasImageBuffer() const {
|
| - return canvas()->HasImageBuffer();
|
| + return host()->HasImageBuffer();
|
| }
|
|
|
| ImageBuffer* CanvasRenderingContext2D::GetImageBuffer() const {
|
| - return canvas()->Buffer();
|
| + return host()->GetImageBuffer();
|
| }
|
|
|
| PassRefPtr<Image> blink::CanvasRenderingContext2D::GetImage(
|
| @@ -614,7 +614,7 @@ PassRefPtr<Image> blink::CanvasRenderingContext2D::GetImage(
|
| SnapshotReason reason) const {
|
| if (!HasImageBuffer())
|
| return nullptr;
|
| - return canvas()->Buffer()->NewImageSnapshot(hint, reason);
|
| + return host()->GetImageBuffer()->NewImageSnapshot(hint, reason);
|
| }
|
|
|
| bool CanvasRenderingContext2D::ParseColorOrCurrentColor(
|
| @@ -979,8 +979,8 @@ float CanvasRenderingContext2D::GetFontBaseline(
|
| }
|
|
|
| void CanvasRenderingContext2D::SetIsHidden(bool hidden) {
|
| - if (canvas()->HasImageBuffer())
|
| - canvas()->Buffer()->SetIsHidden(hidden);
|
| + if (host()->HasImageBuffer())
|
| + host()->GetImageBuffer()->SetIsHidden(hidden);
|
| if (hidden) {
|
| PruneLocalFontCache(0);
|
| }
|
| @@ -991,7 +991,8 @@ bool CanvasRenderingContext2D::IsTransformInvertible() const {
|
| }
|
|
|
| WebLayer* CanvasRenderingContext2D::PlatformLayer() const {
|
| - return canvas()->Buffer() ? canvas()->Buffer()->PlatformLayer() : 0;
|
| + return host()->GetImageBuffer() ? host()->GetImageBuffer()->PlatformLayer()
|
| + : 0;
|
| }
|
|
|
| void CanvasRenderingContext2D::getContextAttributes(
|
|
|