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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 T remove(int handle) | 81 T remove(int handle) |
82 { | 82 { |
83 T value = m_handleToValueMap.take(handle); | 83 T value = m_handleToValueMap.take(handle); |
84 m_valueToHandleMap.remove(value); | 84 m_valueToHandleMap.remove(value); |
85 return value; | 85 return value; |
86 } | 86 } |
87 | 87 |
88 int removeByValue(T value) | 88 int removeByValue(T value) |
89 { | 89 { |
90 int handle = m_valueToHandleMap.take(value); | 90 int handle = m_valueToHandleMap.take(value); |
91 m_handleToValueMap.remove(handle); | 91 // TODO(alanknight): This is clearly wrong. We should never call this |
| 92 // with an invalid value, but we are doing so sometimes in isolate |
| 93 // shutdown. We need to track down the underlying cause, but this |
| 94 // is a workaround. |
| 95 if (handle != 0) { |
| 96 m_handleToValueMap.remove(handle); |
| 97 } |
92 return handle; | 98 return handle; |
93 } | 99 } |
94 | 100 |
95 void copyValues(Vector<T>& values) | 101 void copyValues(Vector<T>& values) |
96 { | 102 { |
97 copyKeysToVector(m_valueToHandleMap, values); | 103 copyKeysToVector(m_valueToHandleMap, values); |
98 } | 104 } |
99 | 105 |
100 private: | 106 private: |
101 int m_lastHandle; | 107 int m_lastHandle; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 PageScriptDebugServer::ClientMessageLoop* m_clientMessageLoop; | 278 PageScriptDebugServer::ClientMessageLoop* m_clientMessageLoop; |
273 | 279 |
274 DartInjectedScriptManager* m_injectedScriptManager; | 280 DartInjectedScriptManager* m_injectedScriptManager; |
275 | 281 |
276 int m_nextPageId; | 282 int m_nextPageId; |
277 }; | 283 }; |
278 | 284 |
279 } | 285 } |
280 | 286 |
281 #endif // DartScriptDebugServer_h | 287 #endif // DartScriptDebugServer_h |
OLD | NEW |