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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 { | 469 { |
470 if (m_surface) | 470 if (m_surface) |
471 return m_surface.get(); | 471 return m_surface.get(); |
472 | 472 |
473 if (m_layer && !isHibernating() && hint == PreferAcceleration) { | 473 if (m_layer && !isHibernating() && hint == PreferAcceleration) { |
474 return nullptr; // re-creation will happen through restore() | 474 return nullptr; // re-creation will happen through restore() |
475 } | 475 } |
476 | 476 |
477 bool wantAcceleration = shouldAccelerate(hint); | 477 bool wantAcceleration = shouldAccelerate(hint); |
478 bool surfaceIsAccelerated; | 478 bool surfaceIsAccelerated; |
479 | 479 if (CANVAS2D_BACKGROUND_RENDER_SWITCH_TO_CPU && isHidden() && wantAccelerati
on) { |
480 if (isHidden() && wantAcceleration) { | |
481 wantAcceleration = false; | 480 wantAcceleration = false; |
482 m_softwareRenderingWhileHidden = true; | 481 m_softwareRenderingWhileHidden = true; |
483 } | 482 } |
484 | 483 |
485 m_surface = createSkSurface(wantAcceleration ? m_contextProvider->grContext(
) : nullptr, m_size, m_msaaSampleCount, m_opacityMode, &surfaceIsAccelerated); | 484 m_surface = createSkSurface(wantAcceleration ? m_contextProvider->grContext(
) : nullptr, m_size, m_msaaSampleCount, m_opacityMode, &surfaceIsAccelerated); |
486 | 485 |
487 if (!m_surface) | 486 if (!m_surface) |
488 reportSurfaceCreationFailure(); | 487 reportSurfaceCreationFailure(); |
489 | 488 |
490 if (m_surface && surfaceIsAccelerated && !m_layer) { | 489 if (m_surface && surfaceIsAccelerated && !m_layer) { |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 999 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
1001 } | 1000 } |
1002 | 1001 |
1003 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) | 1002 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) |
1004 { | 1003 { |
1005 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); | 1004 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); |
1006 hibernationHistogram.count(event); | 1005 hibernationHistogram.count(event); |
1007 } | 1006 } |
1008 | 1007 |
1009 } // namespace blink | 1008 } // namespace blink |
OLD | NEW |