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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2589143003: Add 'get' prefix for Settings.in generated code. (Closed)
Patch Set: Only get prefix and no capitalization. Created 3 years, 11 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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 void HTMLCanvasElement::removeListener(CanvasDrawListener* listener) { 779 void HTMLCanvasElement::removeListener(CanvasDrawListener* listener) {
780 m_listeners.remove(listener); 780 m_listeners.remove(listener);
781 } 781 }
782 782
783 SecurityOrigin* HTMLCanvasElement::getSecurityOrigin() const { 783 SecurityOrigin* HTMLCanvasElement::getSecurityOrigin() const {
784 return document().getSecurityOrigin(); 784 return document().getSecurityOrigin();
785 } 785 }
786 786
787 bool HTMLCanvasElement::originClean() const { 787 bool HTMLCanvasElement::originClean() const {
788 if (document().settings() && 788 if (document().settings() &&
789 document().settings()->disableReadingFromCanvas()) 789 document().settings()->getDisableReadingFromCanvas())
790 return false; 790 return false;
791 if (placeholderFrame()) 791 if (placeholderFrame())
792 return placeholderFrame()->originClean(); 792 return placeholderFrame()->originClean();
793 return m_originClean; 793 return m_originClean;
794 } 794 }
795 795
796 bool HTMLCanvasElement::shouldAccelerate(const IntSize& size) const { 796 bool HTMLCanvasElement::shouldAccelerate(const IntSize& size) const {
797 if (m_context && !m_context->is2d()) 797 if (m_context && !m_context->is2d())
798 return false; 798 return false;
799 799
(...skipping 27 matching lines...) Expand all
827 #endif 827 #endif
828 // If the GPU resources would be very expensive, prefer a display list. 828 // If the GPU resources would be very expensive, prefer a display list.
829 if (canvasPixelCount > ExpensiveCanvasHeuristicParameters:: 829 if (canvasPixelCount > ExpensiveCanvasHeuristicParameters::
830 PreferDisplayListOverGpuSizeThreshold) 830 PreferDisplayListOverGpuSizeThreshold)
831 return false; 831 return false;
832 } 832 }
833 833
834 // Do not use acceleration for small canvas. 834 // Do not use acceleration for small canvas.
835 Settings* settings = document().settings(); 835 Settings* settings = document().settings();
836 if (!settings || 836 if (!settings ||
837 canvasPixelCount < settings->minimumAccelerated2dCanvasSize()) 837 canvasPixelCount < settings->getMinimumAccelerated2dCanvasSize())
838 return false; 838 return false;
839 839
840 // When GPU allocated memory runs low (due to having created too many 840 // When GPU allocated memory runs low (due to having created too many
841 // accelerated canvases), the compositor starves and browser becomes laggy. 841 // accelerated canvases), the compositor starves and browser becomes laggy.
842 // Thus, we should stop allocating more GPU memory to new canvases created 842 // Thus, we should stop allocating more GPU memory to new canvases created
843 // when the current memory usage exceeds the threshold. 843 // when the current memory usage exceeds the threshold.
844 if (ImageBuffer::getGlobalGPUMemoryUsage() >= MaxGlobalGPUMemoryUsage) 844 if (ImageBuffer::getGlobalGPUMemoryUsage() >= MaxGlobalGPUMemoryUsage)
845 return false; 845 return false;
846 846
847 // Allocating too many GPU resources can makes us run into the driver's 847 // Allocating too many GPU resources can makes us run into the driver's
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 } 902 }
903 903
904 std::unique_ptr<ImageBufferSurface> 904 std::unique_ptr<ImageBufferSurface>
905 HTMLCanvasElement::createAcceleratedImageBufferSurface( 905 HTMLCanvasElement::createAcceleratedImageBufferSurface(
906 const IntSize& deviceSize, 906 const IntSize& deviceSize,
907 OpacityMode opacityMode, 907 OpacityMode opacityMode,
908 int* msaaSampleCount) { 908 int* msaaSampleCount) {
909 if (!shouldAccelerate(deviceSize)) 909 if (!shouldAccelerate(deviceSize))
910 return nullptr; 910 return nullptr;
911 911
912 if (document().settings()) 912 if (document().settings()) {
913 *msaaSampleCount = 913 *msaaSampleCount =
914 document().settings()->accelerated2dCanvasMSAASampleCount(); 914 document().settings()->getAccelerated2dCanvasMSAASampleCount();
915 }
915 916
916 // Avoid creating |contextProvider| until we're sure we want to try use it, 917 // Avoid creating |contextProvider| until we're sure we want to try use it,
917 // since it costs us GPU memory. 918 // since it costs us GPU memory.
918 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider( 919 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(
919 Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); 920 Platform::current()->createSharedOffscreenGraphicsContext3DProvider());
920 if (!contextProvider) { 921 if (!contextProvider) {
921 CanvasMetrics::countCanvasContextUsage( 922 CanvasMetrics::countCanvasContextUsage(
922 CanvasMetrics::Accelerated2DCanvasGPUContextLost); 923 CanvasMetrics::Accelerated2DCanvasGPUContextLost);
923 return nullptr; 924 return nullptr;
924 } 925 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 // Early out for WebGL canvases 1023 // Early out for WebGL canvases
1023 return; 1024 return;
1024 } 1025 }
1025 1026
1026 m_imageBuffer->setClient(this); 1027 m_imageBuffer->setClient(this);
1027 // Enabling MSAA overrides a request to disable antialiasing. This is true 1028 // Enabling MSAA overrides a request to disable antialiasing. This is true
1028 // regardless of whether the rendering mode is accelerated or not. For 1029 // regardless of whether the rendering mode is accelerated or not. For
1029 // consistency, we don't want to apply AA in accelerated canvases but not in 1030 // consistency, we don't want to apply AA in accelerated canvases but not in
1030 // unaccelerated canvases. 1031 // unaccelerated canvases.
1031 if (!msaaSampleCount && document().settings() && 1032 if (!msaaSampleCount && document().settings() &&
1032 !document().settings()->antialiased2dCanvasEnabled()) 1033 !document().settings()->getAntialiased2dCanvasEnabled())
1033 m_context->setShouldAntialias(false); 1034 m_context->setShouldAntialias(false);
1034 1035
1035 if (m_context) 1036 if (m_context)
1036 setNeedsCompositingUpdate(); 1037 setNeedsCompositingUpdate();
1037 } 1038 }
1038 1039
1039 void HTMLCanvasElement::notifySurfaceInvalid() { 1040 void HTMLCanvasElement::notifySurfaceInvalid() {
1040 if (m_context && m_context->is2d()) 1041 if (m_context && m_context->is2d())
1041 m_context->loseContext(CanvasRenderingContext::RealLostContext); 1042 m_context->loseContext(CanvasRenderingContext::RealLostContext);
1042 } 1043 }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this)); 1414 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this));
1414 // Creates a placeholder layer first before Surface is created. 1415 // Creates a placeholder layer first before Surface is created.
1415 m_surfaceLayerBridge->createSolidColorLayer(); 1416 m_surfaceLayerBridge->createSolidColorLayer();
1416 } 1417 }
1417 1418
1418 void HTMLCanvasElement::OnWebLayerReplaced() { 1419 void HTMLCanvasElement::OnWebLayerReplaced() {
1419 setNeedsCompositingUpdate(); 1420 setNeedsCompositingUpdate();
1420 } 1421 }
1421 1422
1422 } // namespace blink 1423 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698