| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 void CCScheduler::setMainThreadNeedsLayerTextures() | 83 void CCScheduler::setMainThreadNeedsLayerTextures() |
| 84 { | 84 { |
| 85 m_stateMachine.setMainThreadNeedsLayerTextures(); | 85 m_stateMachine.setMainThreadNeedsLayerTextures(); |
| 86 processScheduledActions(); | 86 processScheduledActions(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void CCScheduler::beginFrameComplete() | 89 void CCScheduler::beginFrameComplete() |
| 90 { | 90 { |
| 91 TRACE_EVENT("CCScheduler::beginFrameComplete", this, 0); | 91 TRACE_EVENT0("cc", "CCScheduler::beginFrameComplete"); |
| 92 m_stateMachine.beginFrameComplete(); | 92 m_stateMachine.beginFrameComplete(); |
| 93 processScheduledActions(); | 93 processScheduledActions(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void CCScheduler::beginFrameAborted() |
| 97 { |
| 98 TRACE_EVENT0("cc", "CCScheduler::beginFrameAborted"); |
| 99 m_stateMachine.beginFrameAborted(); |
| 100 processScheduledActions(); |
| 101 } |
| 102 |
| 96 void CCScheduler::setMaxFramesPending(int maxFramesPending) | 103 void CCScheduler::setMaxFramesPending(int maxFramesPending) |
| 97 { | 104 { |
| 98 m_frameRateController->setMaxFramesPending(maxFramesPending); | 105 m_frameRateController->setMaxFramesPending(maxFramesPending); |
| 99 } | 106 } |
| 100 | 107 |
| 101 void CCScheduler::didSwapBuffersComplete() | 108 void CCScheduler::didSwapBuffersComplete() |
| 102 { | 109 { |
| 103 TRACE_EVENT("CCScheduler::didSwapBuffersComplete", this, 0); | 110 TRACE_EVENT0("cc", "CCScheduler::didSwapBuffersComplete"); |
| 104 m_frameRateController->didFinishFrame(); | 111 m_frameRateController->didFinishFrame(); |
| 105 } | 112 } |
| 106 | 113 |
| 107 void CCScheduler::didLoseContext() | 114 void CCScheduler::didLoseContext() |
| 108 { | 115 { |
| 109 TRACE_EVENT("CCScheduler::didLoseContext", this, 0); | 116 TRACE_EVENT0("cc", "CCScheduler::didLoseContext"); |
| 110 m_frameRateController->didAbortAllPendingFrames(); | 117 m_frameRateController->didAbortAllPendingFrames(); |
| 111 m_stateMachine.didLoseContext(); | 118 m_stateMachine.didLoseContext(); |
| 112 processScheduledActions(); | 119 processScheduledActions(); |
| 113 } | 120 } |
| 114 | 121 |
| 115 void CCScheduler::didRecreateContext() | 122 void CCScheduler::didRecreateContext() |
| 116 { | 123 { |
| 117 TRACE_EVENT("CCScheduler::didRecreateContext", this, 0); | 124 TRACE_EVENT0("cc", "CCScheduler::didRecreateContext"); |
| 118 m_stateMachine.didRecreateContext(); | 125 m_stateMachine.didRecreateContext(); |
| 119 processScheduledActions(); | 126 processScheduledActions(); |
| 120 } | 127 } |
| 121 | 128 |
| 122 void CCScheduler::vsyncTick() | 129 void CCScheduler::vsyncTick() |
| 123 { | 130 { |
| 124 if (m_updateMoreResourcesPending) { | 131 if (m_updateMoreResourcesPending) { |
| 125 m_updateMoreResourcesPending = false; | 132 m_updateMoreResourcesPending = false; |
| 126 m_stateMachine.beginUpdateMoreResourcesComplete(m_client->hasMoreResourc
eUpdates()); | 133 m_stateMachine.beginUpdateMoreResourcesComplete(m_client->hasMoreResourc
eUpdates()); |
| 127 } | 134 } |
| 128 TRACE_EVENT("CCScheduler::vsyncTick", this, 0); | 135 TRACE_EVENT0("cc", "CCScheduler::vsyncTick"); |
| 129 | 136 |
| 130 m_stateMachine.didEnterVSync(); | 137 m_stateMachine.didEnterVSync(); |
| 131 processScheduledActions(); | 138 processScheduledActions(); |
| 132 m_stateMachine.didLeaveVSync(); | 139 m_stateMachine.didLeaveVSync(); |
| 133 } | 140 } |
| 134 | 141 |
| 135 CCSchedulerStateMachine::Action CCScheduler::nextAction() | 142 CCSchedulerStateMachine::Action CCScheduler::nextAction() |
| 136 { | 143 { |
| 137 m_stateMachine.setCanDraw(m_client->canDraw()); | 144 m_stateMachine.setCanDraw(m_client->canDraw()); |
| 138 return m_stateMachine.nextAction(); | 145 return m_stateMachine.nextAction(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 m_client->scheduledActionAcquireLayerTexturesForMainThread(); | 200 m_client->scheduledActionAcquireLayerTexturesForMainThread(); |
| 194 break; | 201 break; |
| 195 } | 202 } |
| 196 } while (action != CCSchedulerStateMachine::ACTION_NONE); | 203 } while (action != CCSchedulerStateMachine::ACTION_NONE); |
| 197 | 204 |
| 198 // Activate or deactivate the frame rate controller. | 205 // Activate or deactivate the frame rate controller. |
| 199 m_frameRateController->setActive(m_stateMachine.vsyncCallbackNeeded()); | 206 m_frameRateController->setActive(m_stateMachine.vsyncCallbackNeeded()); |
| 200 } | 207 } |
| 201 | 208 |
| 202 } | 209 } |
| OLD | NEW |