| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "platform/Histogram.h" | 29 #include "platform/Histogram.h" |
| 30 #include "platform/RuntimeEnabledFeatures.h" | 30 #include "platform/RuntimeEnabledFeatures.h" |
| 31 #include "platform/TraceEvent.h" | 31 #include "platform/TraceEvent.h" |
| 32 #include "platform/graphics/CanvasMetrics.h" | 32 #include "platform/graphics/CanvasMetrics.h" |
| 33 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 33 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 34 #include "platform/graphics/GraphicsLayer.h" | 34 #include "platform/graphics/GraphicsLayer.h" |
| 35 #include "platform/graphics/ImageBuffer.h" | 35 #include "platform/graphics/ImageBuffer.h" |
| 36 #include "platform/graphics/gpu/SharedContextRateLimiter.h" | 36 #include "platform/graphics/gpu/SharedContextRateLimiter.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebCompositorSupport.h" | 38 #include "public/platform/WebCompositorSupport.h" |
| 39 #include "public/platform/WebGraphicsContext3D.h" | |
| 40 #include "public/platform/WebGraphicsContext3DProvider.h" | 39 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 41 #include "public/platform/WebScheduler.h" | 40 #include "public/platform/WebScheduler.h" |
| 42 #include "public/platform/WebTraceLocation.h" | 41 #include "public/platform/WebTraceLocation.h" |
| 43 #include "skia/ext/texture_handle.h" | 42 #include "skia/ext/texture_handle.h" |
| 44 #include "third_party/skia/include/core/SkData.h" | 43 #include "third_party/skia/include/core/SkData.h" |
| 45 #include "third_party/skia/include/core/SkPictureRecorder.h" | 44 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 46 #include "third_party/skia/include/core/SkSurface.h" | 45 #include "third_party/skia/include/core/SkSurface.h" |
| 47 #include "third_party/skia/include/gpu/GrContext.h" | 46 #include "third_party/skia/include/gpu/GrContext.h" |
| 48 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" | 47 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
| 49 | 48 |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 void Canvas2DLayerBridge::flushGpu() | 682 void Canvas2DLayerBridge::flushGpu() |
| 684 { | 683 { |
| 685 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushGpu"); | 684 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushGpu"); |
| 686 flush(); | 685 flush(); |
| 687 gpu::gles2::GLES2Interface* gl = contextGL(); | 686 gpu::gles2::GLES2Interface* gl = contextGL(); |
| 688 if (isAccelerated() && gl) | 687 if (isAccelerated() && gl) |
| 689 gl->Flush(); | 688 gl->Flush(); |
| 690 } | 689 } |
| 691 | 690 |
| 692 | 691 |
| 693 WebGraphicsContext3D* Canvas2DLayerBridge::context() | |
| 694 { | |
| 695 // Check on m_layer is necessary because context() may be called during | |
| 696 // the destruction of m_layer | |
| 697 if (m_layer && !m_destructionInProgress) | |
| 698 checkSurfaceValid(); // To ensure rate limiter is disabled if context is
lost. | |
| 699 return m_contextProvider ? m_contextProvider->context3d() : 0; | |
| 700 } | |
| 701 | |
| 702 gpu::gles2::GLES2Interface* Canvas2DLayerBridge::contextGL() | 692 gpu::gles2::GLES2Interface* Canvas2DLayerBridge::contextGL() |
| 703 { | 693 { |
| 704 // Check on m_layer is necessary because contextGL() may be called during | 694 // Check on m_layer is necessary because contextGL() may be called during |
| 705 // the destruction of m_layer | 695 // the destruction of m_layer |
| 706 if (m_layer && !m_destructionInProgress) { | 696 if (m_layer && !m_destructionInProgress) { |
| 707 // Ensure rate limiter is disabled if context is lost. | 697 // Ensure rate limiter is disabled if context is lost. |
| 708 checkSurfaceValid(); | 698 checkSurfaceValid(); |
| 709 } | 699 } |
| 710 return m_contextProvider ? m_contextProvider->contextGL() : nullptr; | 700 return m_contextProvider ? m_contextProvider->contextGL() : nullptr; |
| 711 } | 701 } |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 973 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 984 } | 974 } |
| 985 | 975 |
| 986 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) | 976 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) |
| 987 { | 977 { |
| 988 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); | 978 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); |
| 989 hibernationHistogram.count(event); | 979 hibernationHistogram.count(event); |
| 990 } | 980 } |
| 991 | 981 |
| 992 } // namespace blink | 982 } // namespace blink |
| OLD | NEW |