| 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 * | 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 void InspectorCompositeState::loadFromCookie(const String& inspectorCompositeSta
teCookie) | 141 void InspectorCompositeState::loadFromCookie(const String& inspectorCompositeSta
teCookie) |
| 142 { | 142 { |
| 143 RefPtr<JSONValue> cookie = parseJSON(inspectorCompositeStateCookie); | 143 RefPtr<JSONValue> cookie = parseJSON(inspectorCompositeStateCookie); |
| 144 if (cookie) | 144 if (cookie) |
| 145 m_stateObject = cookie->asObject(); | 145 m_stateObject = cookie->asObject(); |
| 146 if (!m_stateObject) | 146 if (!m_stateObject) |
| 147 m_stateObject = JSONObject::create(); | 147 m_stateObject = JSONObject::create(); |
| 148 | 148 |
| 149 InspectorStateMap::iterator end = m_inspectorStateMap.end(); | 149 for (auto& state : m_inspectorStateMap) { |
| 150 for (InspectorStateMap::iterator it = m_inspectorStateMap.begin(); it != end
; ++it) { | 150 RefPtr<JSONObject> agentStateObject = m_stateObject->getObject(state.key
); |
| 151 RefPtr<JSONObject> agentStateObject = m_stateObject->getObject(it->key); | |
| 152 if (!agentStateObject) { | 151 if (!agentStateObject) { |
| 153 agentStateObject = JSONObject::create(); | 152 agentStateObject = JSONObject::create(); |
| 154 m_stateObject->setObject(it->key, agentStateObject); | 153 m_stateObject->setObject(state.key, agentStateObject); |
| 155 } | 154 } |
| 156 it->value->setFromCookie(agentStateObject); | 155 state.value->setFromCookie(agentStateObject); |
| 157 } | 156 } |
| 158 } | 157 } |
| 159 | 158 |
| 160 void InspectorCompositeState::mute() | 159 void InspectorCompositeState::mute() |
| 161 { | 160 { |
| 162 m_isMuted = true; | 161 m_isMuted = true; |
| 163 } | 162 } |
| 164 | 163 |
| 165 void InspectorCompositeState::unmute() | 164 void InspectorCompositeState::unmute() |
| 166 { | 165 { |
| 167 m_isMuted = false; | 166 m_isMuted = false; |
| 168 } | 167 } |
| 169 | 168 |
| 170 void InspectorCompositeState::inspectorStateUpdated() | 169 void InspectorCompositeState::inspectorStateUpdated() |
| 171 { | 170 { |
| 172 if (m_client && !m_isMuted) | 171 if (m_client && !m_isMuted) |
| 173 m_client->updateInspectorStateCookie(m_stateObject->toJSONString()); | 172 m_client->updateInspectorStateCookie(m_stateObject->toJSONString()); |
| 174 } | 173 } |
| 175 | 174 |
| 176 void InspectorCompositeState::trace(Visitor* visitor) | 175 void InspectorCompositeState::trace(Visitor* visitor) |
| 177 { | 176 { |
| 178 #if ENABLE(OILPAN) | 177 #if ENABLE(OILPAN) |
| 179 visitor->trace(m_inspectorStateMap); | 178 visitor->trace(m_inspectorStateMap); |
| 180 #endif | 179 #endif |
| 181 } | 180 } |
| 182 | 181 |
| 183 } // namespace blink | 182 } // namespace blink |
| 184 | 183 |
| OLD | NEW |