| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #ifndef HTMLImportState_h | 31 #ifndef HTMLImportState_h |
| 32 #define HTMLImportState_h | 32 #define HTMLImportState_h |
| 33 | 33 |
| 34 #include "wtf/Assertions.h" | 34 #include "wtf/Assertions.h" |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| 37 | 37 |
| 38 class HTMLImportState { | 38 class HTMLImportState { |
| 39 public: | 39 public: |
| 40 enum Value { | 40 enum Value { |
| 41 BlockingDocumentCreation = 0, | 41 BlockingScriptExecution = 0, |
| 42 BlockingScriptExecution, | |
| 43 Active, | 42 Active, |
| 44 Ready, | 43 Ready, |
| 45 Invalid | 44 Invalid |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 explicit HTMLImportState(Value value = BlockingDocumentCreation) | 47 explicit HTMLImportState(Value value = BlockingScriptExecution) |
| 49 : m_value(value) | 48 : m_value(value) |
| 50 { } | 49 { } |
| 51 | 50 |
| 52 bool shouldBlockScriptExecution() const { return checkedValue() <= BlockingS
criptExecution; } | 51 bool shouldBlockScriptExecution() const { return checkedValue() <= BlockingS
criptExecution; } |
| 53 bool shouldBlockDocumentCreation() const { return checkedValue() <= Blocking
DocumentCreation; } | |
| 54 bool isReady() const { return checkedValue() == Ready; } | 52 bool isReady() const { return checkedValue() == Ready; } |
| 55 bool isValid() const { return m_value != Invalid; } | 53 bool isValid() const { return m_value != Invalid; } |
| 56 bool operator==(const HTMLImportState& other) const { return m_value == othe
r.m_value; } | 54 bool operator==(const HTMLImportState& other) const { return m_value == othe
r.m_value; } |
| 57 bool operator!=(const HTMLImportState& other) const { return !(*this == othe
r); } | 55 bool operator!=(const HTMLImportState& other) const { return !(*this == othe
r); } |
| 58 bool operator<=(const HTMLImportState& other) const { return m_value <= othe
r.m_value; } | 56 bool operator<=(const HTMLImportState& other) const { return m_value <= othe
r.m_value; } |
| 59 | 57 |
| 60 #if !defined(NDEBUG) | 58 #if !defined(NDEBUG) |
| 61 Value peekValueForDebug() const { return m_value; } | 59 Value peekValueForDebug() const { return m_value; } |
| 62 #endif | 60 #endif |
| 63 | 61 |
| 64 static HTMLImportState invalidState() { return HTMLImportState(Invalid); } | 62 static HTMLImportState invalidState() { return HTMLImportState(Invalid); } |
| 65 static HTMLImportState blockedState() { return HTMLImportState(BlockingDocum
entCreation); } | 63 static HTMLImportState blockedState() { return HTMLImportState(BlockingScrip
tExecution); } |
| 66 private: | 64 private: |
| 67 Value checkedValue() const; | 65 Value checkedValue() const; |
| 68 Value m_value; | 66 Value m_value; |
| 69 }; | 67 }; |
| 70 | 68 |
| 71 inline HTMLImportState::Value HTMLImportState::checkedValue() const | 69 inline HTMLImportState::Value HTMLImportState::checkedValue() const |
| 72 { | 70 { |
| 73 ASSERT(isValid()); | 71 ASSERT(isValid()); |
| 74 return m_value; | 72 return m_value; |
| 75 } | 73 } |
| 76 | 74 |
| 77 } | 75 } |
| 78 | 76 |
| 79 #endif | 77 #endif |
| OLD | NEW |