OLD | NEW |
1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
2 // All rights reserved. | 2 // 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // FIXME: proper implementation. | 68 // FIXME: proper implementation. |
69 DART_UNIMPLEMENTED(); | 69 DART_UNIMPLEMENTED(); |
70 } | 70 } |
71 | 71 |
72 void historyCrossFrameGetter(Dart_NativeArguments args) | 72 void historyCrossFrameGetter(Dart_NativeArguments args) |
73 { | 73 { |
74 { | 74 { |
75 DOMWindow* receiver = DartDOMWrapper::receiver<DOMWindow>(args); | 75 DOMWindow* receiver = DartDOMWrapper::receiver<DOMWindow>(args); |
76 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); | 76 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); |
77 | 77 |
| 78 Dart_WeakPersistentHandle existingWrapper = DartDOMWrapper::lookupWrappe
r<DartHistory>(domData, &receiver->history()); |
| 79 if (existingWrapper) { |
| 80 Dart_SetWeakHandleReturnValue(args, existingWrapper); |
| 81 return; |
| 82 } |
| 83 |
78 Dart_Handle result = DartDOMWrapper::createWrapper<DartHistory>( | 84 Dart_Handle result = DartDOMWrapper::createWrapper<DartHistory>( |
79 domData, &receiver->history(), _HistoryCrossFrameClassId); | 85 domData, &receiver->history(), _HistoryCrossFrameClassId); |
80 if (result) | 86 if (result) |
81 Dart_SetReturnValue(args, result); | 87 Dart_SetReturnValue(args, result); |
82 } | 88 } |
83 } | 89 } |
84 | 90 |
85 void locationCrossFrameGetter(Dart_NativeArguments args) | 91 void locationCrossFrameGetter(Dart_NativeArguments args) |
86 { | 92 { |
87 { | 93 { |
88 DOMWindow* receiver = DartDOMWrapper::receiver<DOMWindow>(args); | 94 DOMWindow* receiver = DartDOMWrapper::receiver<DOMWindow>(args); |
89 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); | 95 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa
ta(args)); |
90 | 96 |
| 97 Dart_WeakPersistentHandle existingWrapper = DartDOMWrapper::lookupWrappe
r<DartLocation>(domData, &receiver->location()); |
| 98 if (existingWrapper) { |
| 99 Dart_SetWeakHandleReturnValue(args, existingWrapper); |
| 100 return; |
| 101 } |
| 102 |
91 Dart_Handle result = DartDOMWrapper::createWrapper<DartLocation>( | 103 Dart_Handle result = DartDOMWrapper::createWrapper<DartLocation>( |
92 domData, &receiver->location(), _LocationCrossFrameClassId); | 104 domData, &receiver->location(), _LocationCrossFrameClassId); |
93 if (result) | 105 if (result) |
94 Dart_SetReturnValue(args, result); | 106 Dart_SetReturnValue(args, result); |
95 } | 107 } |
96 } | 108 } |
97 | 109 |
98 void locationSetter(Dart_NativeArguments args) | 110 void locationSetter(Dart_NativeArguments args) |
99 { | 111 { |
100 Dart_Handle exception = 0; | 112 Dart_Handle exception = 0; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 336 |
325 } | 337 } |
326 | 338 |
327 Dart_Handle DartWindow::createWrapper(DartDOMData* domData, DOMWindow* window) | 339 Dart_Handle DartWindow::createWrapper(DartDOMData* domData, DOMWindow* window) |
328 { | 340 { |
329 return DartDOMWrapper::createWrapper<DartWindow>( | 341 return DartDOMWrapper::createWrapper<DartWindow>( |
330 domData, window, _DOMWindowCrossFrameClassId); | 342 domData, window, _DOMWindowCrossFrameClassId); |
331 } | 343 } |
332 | 344 |
333 } | 345 } |
OLD | NEW |