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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 DCHECK(isAccelerated() || isHibernating() || m_softwareRenderingWhileHidden); | 916 DCHECK(isAccelerated() || isHibernating() || m_softwareRenderingWhileHidden); |
917 | 917 |
918 // if hibernating but not hidden, we want to wake up from | 918 // if hibernating but not hidden, we want to wake up from |
919 // hibernation | 919 // hibernation |
920 if ((isHibernating() || m_softwareRenderingWhileHidden) && isHidden()) | 920 if ((isHibernating() || m_softwareRenderingWhileHidden) && isHidden()) |
921 return false; | 921 return false; |
922 | 922 |
923 // If the context is lost, we don't know if we should be producing GPU or | 923 // If the context is lost, we don't know if we should be producing GPU or |
924 // software frames, until we get a new context, since the compositor will | 924 // software frames, until we get a new context, since the compositor will |
925 // be trying to get a new context and may change modes. | 925 // be trying to get a new context and may change modes. |
926 if (m_contextProvider->contextGL()->GetGraphicsResetStatusKHR() != | 926 if (!m_contextProvider || |
927 GL_NO_ERROR) | 927 m_contextProvider->contextGL()->GetGraphicsResetStatusKHR() != |
| 928 GL_NO_ERROR) |
928 return false; | 929 return false; |
929 | 930 |
930 sk_sp<SkImage> image = | 931 sk_sp<SkImage> image = |
931 newImageSnapshot(PreferAcceleration, SnapshotReasonUnknown); | 932 newImageSnapshot(PreferAcceleration, SnapshotReasonUnknown); |
932 if (!image || !image->getTexture()) | 933 if (!image || !image->getTexture()) |
933 return false; | 934 return false; |
934 | 935 |
935 // Early exit if canvas was not drawn to since last prepareMailbox. | 936 // Early exit if canvas was not drawn to since last prepareMailbox. |
936 GLenum filter = getGLFilter(); | 937 GLenum filter = getGLFilter(); |
937 if (image->uniqueID() == m_lastImageId && filter == m_lastFilter) | 938 if (image->uniqueID() == m_lastImageId && filter == m_lastFilter) |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 default; | 1142 default; |
1142 | 1143 |
1143 void Canvas2DLayerBridge::Logger::reportHibernationEvent( | 1144 void Canvas2DLayerBridge::Logger::reportHibernationEvent( |
1144 HibernationEvent event) { | 1145 HibernationEvent event) { |
1145 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, | 1146 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, |
1146 ("Canvas.HibernationEvents", HibernationEventCount)); | 1147 ("Canvas.HibernationEvents", HibernationEventCount)); |
1147 hibernationHistogram.count(event); | 1148 hibernationHistogram.count(event); |
1148 } | 1149 } |
1149 | 1150 |
1150 } // namespace blink | 1151 } // namespace blink |
OLD | NEW |