| 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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 unregisterTaskObserver(); | 940 unregisterTaskObserver(); |
| 941 } | 941 } |
| 942 | 942 |
| 943 void Canvas2DLayerBridge::willProcessTask() | 943 void Canvas2DLayerBridge::willProcessTask() |
| 944 { | 944 { |
| 945 ASSERT_NOT_REACHED(); | 945 ASSERT_NOT_REACHED(); |
| 946 } | 946 } |
| 947 | 947 |
| 948 PassRefPtr<SkImage> Canvas2DLayerBridge::newImageSnapshot(AccelerationHint hint,
SnapshotReason) | 948 PassRefPtr<SkImage> Canvas2DLayerBridge::newImageSnapshot(AccelerationHint hint,
SnapshotReason) |
| 949 { | 949 { |
| 950 if (isHibernating()) |
| 951 return m_hibernationImage; |
| 950 if (!checkSurfaceValid()) | 952 if (!checkSurfaceValid()) |
| 951 return nullptr; | 953 return nullptr; |
| 952 if (!getOrCreateSurface(hint)) | 954 if (!getOrCreateSurface(hint)) |
| 953 return nullptr; | 955 return nullptr; |
| 954 flush(); | 956 flush(); |
| 955 // A readback operation may alter the texture parameters, which may affect | 957 // A readback operation may alter the texture parameters, which may affect |
| 956 // the compositor's behavior. Therefore, we must trigger copy-on-write | 958 // the compositor's behavior. Therefore, we must trigger copy-on-write |
| 957 // even though we are not technically writing to the texture, only to its | 959 // even though we are not technically writing to the texture, only to its |
| 958 // parameters. | 960 // parameters. |
| 959 getOrCreateSurface()->notifyContentWillChange(SkSurface::kRetain_ContentChan
geMode); | 961 getOrCreateSurface()->notifyContentWillChange(SkSurface::kRetain_ContentChan
geMode); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 994 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 993 } | 995 } |
| 994 | 996 |
| 995 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) | 997 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) |
| 996 { | 998 { |
| 997 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); | 999 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); |
| 998 hibernationHistogram.count(event); | 1000 hibernationHistogram.count(event); |
| 999 } | 1001 } |
| 1000 | 1002 |
| 1001 } // namespace blink | 1003 } // namespace blink |
| OLD | NEW |