| 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 21 matching lines...) Expand all Loading... |
| 32 : m_commitState(COMMIT_STATE_IDLE) | 32 : m_commitState(COMMIT_STATE_IDLE) |
| 33 , m_currentFrameNumber(0) | 33 , m_currentFrameNumber(0) |
| 34 , m_lastFrameNumberWhereDrawWasCalled(-1) | 34 , m_lastFrameNumberWhereDrawWasCalled(-1) |
| 35 , m_needsRedraw(false) | 35 , m_needsRedraw(false) |
| 36 , m_needsForcedRedraw(false) | 36 , m_needsForcedRedraw(false) |
| 37 , m_needsCommit(false) | 37 , m_needsCommit(false) |
| 38 , m_needsForcedCommit(false) | 38 , m_needsForcedCommit(false) |
| 39 , m_updateMoreResourcesPending(false) | 39 , m_updateMoreResourcesPending(false) |
| 40 , m_insideVSync(false) | 40 , m_insideVSync(false) |
| 41 , m_visible(false) | 41 , m_visible(false) |
| 42 , m_canBeginFrame(false) |
| 42 , m_canDraw(true) | 43 , m_canDraw(true) |
| 43 , m_drawIfPossibleFailed(false) | 44 , m_drawIfPossibleFailed(false) |
| 44 , m_contextState(CONTEXT_ACTIVE) | 45 , m_contextState(CONTEXT_ACTIVE) |
| 45 { | 46 { |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool CCSchedulerStateMachine::hasDrawnThisFrame() const | 49 bool CCSchedulerStateMachine::hasDrawnThisFrame() const |
| 49 { | 50 { |
| 50 return m_currentFrameNumber == m_lastFrameNumberWhereDrawWasCalled; | 51 return m_currentFrameNumber == m_lastFrameNumberWhereDrawWasCalled; |
| 51 } | 52 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 77 if (m_contextState != CONTEXT_ACTIVE && m_needsForcedRedraw) | 78 if (m_contextState != CONTEXT_ACTIVE && m_needsForcedRedraw) |
| 78 return ACTION_DRAW_FORCED; | 79 return ACTION_DRAW_FORCED; |
| 79 if (m_contextState != CONTEXT_ACTIVE && m_needsForcedCommit) | 80 if (m_contextState != CONTEXT_ACTIVE && m_needsForcedCommit) |
| 80 return ACTION_BEGIN_FRAME; | 81 return ACTION_BEGIN_FRAME; |
| 81 if (m_contextState == CONTEXT_LOST) | 82 if (m_contextState == CONTEXT_LOST) |
| 82 return ACTION_BEGIN_CONTEXT_RECREATION; | 83 return ACTION_BEGIN_CONTEXT_RECREATION; |
| 83 if (m_contextState == CONTEXT_RECREATING) | 84 if (m_contextState == CONTEXT_RECREATING) |
| 84 return ACTION_NONE; | 85 return ACTION_NONE; |
| 85 if (shouldDraw()) | 86 if (shouldDraw()) |
| 86 return m_needsForcedRedraw ? ACTION_DRAW_FORCED : ACTION_DRAW_IF_POS
SIBLE; | 87 return m_needsForcedRedraw ? ACTION_DRAW_FORCED : ACTION_DRAW_IF_POS
SIBLE; |
| 87 if (m_needsCommit && (m_visible || m_needsForcedCommit)) | 88 if (m_needsCommit && ((m_visible && m_canBeginFrame) || m_needsForcedCom
mit)) |
| 88 return ACTION_BEGIN_FRAME; | 89 return ACTION_BEGIN_FRAME; |
| 89 return ACTION_NONE; | 90 return ACTION_NONE; |
| 90 | 91 |
| 91 case COMMIT_STATE_FRAME_IN_PROGRESS: | 92 case COMMIT_STATE_FRAME_IN_PROGRESS: |
| 92 if (shouldDraw()) | 93 if (shouldDraw()) |
| 93 return m_needsForcedRedraw ? ACTION_DRAW_FORCED : ACTION_DRAW_IF_POS
SIBLE; | 94 return m_needsForcedRedraw ? ACTION_DRAW_FORCED : ACTION_DRAW_IF_POS
SIBLE; |
| 94 return ACTION_NONE; | 95 return ACTION_NONE; |
| 95 | 96 |
| 96 case COMMIT_STATE_UPDATING_RESOURCES: | 97 case COMMIT_STATE_UPDATING_RESOURCES: |
| 97 if (shouldDraw()) | 98 if (shouldDraw()) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 246 } |
| 246 | 247 |
| 247 void CCSchedulerStateMachine::didRecreateContext() | 248 void CCSchedulerStateMachine::didRecreateContext() |
| 248 { | 249 { |
| 249 ASSERT(m_contextState == CONTEXT_RECREATING); | 250 ASSERT(m_contextState == CONTEXT_RECREATING); |
| 250 m_contextState = CONTEXT_ACTIVE; | 251 m_contextState = CONTEXT_ACTIVE; |
| 251 setNeedsCommit(); | 252 setNeedsCommit(); |
| 252 } | 253 } |
| 253 | 254 |
| 254 } | 255 } |
| OLD | NEW |