Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2123)

Side by Side Diff: Source/WebCore/bindings/dart/custom/DartHistoryCustom.cpp

Issue 10660025: Cleanup dart to string conversions. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: . Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 { 47 {
48 DartApiScope dartApiScope; 48 DartApiScope dartApiScope;
49 Dart_Handle exception = 0; 49 Dart_Handle exception = 0;
50 { 50 {
51 History* receiver = DartDOMWrapper::receiver<History>(args); 51 History* receiver = DartDOMWrapper::receiver<History>(args);
52 52
53 RefPtr<SerializedScriptValue> data = DartUtilities::dartToSerializedScri ptValue(Dart_GetNativeArgument(args, 1), exception); 53 RefPtr<SerializedScriptValue> data = DartUtilities::dartToSerializedScri ptValue(Dart_GetNativeArgument(args, 1), exception);
54 if (exception) 54 if (exception)
55 goto fail; 55 goto fail;
56 56
57 const ParameterAdapter<String> title(Dart_GetNativeArgument(args, 2)); 57 DartStringAdapter title = DartUtilities::dartToString(Dart_GetNativeArgu ment(args, 2), exception);
58 if (!title.conversionSuccessful()) { 58 if (exception)
59 exception = title.exception();
60 goto fail; 59 goto fail;
61 }
62 60
63 // FIXME: url argument should be optional. 61 // FIXME: url argument should be optional.
64 const ParameterAdapter<String> url(Dart_GetNativeArgument(args, 3)); 62 DartStringAdapter url = DartUtilities::dartToString(Dart_GetNativeArgume nt(args, 3), exception);
65 if (!url.conversionSuccessful()) { 63 if (exception)
66 exception = url.exception();
67 goto fail; 64 goto fail;
68 }
69 65
70 ExceptionCode ec = 0; 66 ExceptionCode ec = 0;
71 receiver->stateObjectAdded(data.release(), title, url, stateObjectType, ec); 67 receiver->stateObjectAdded(data.release(), title, url, stateObjectType, ec);
72 if (UNLIKELY(ec)) { 68 if (UNLIKELY(ec)) {
73 exception = DartDOMWrapper::exceptionCodeToDartException(ec); 69 exception = DartDOMWrapper::exceptionCodeToDartException(ec);
74 goto fail; 70 goto fail;
75 } 71 }
76 return; 72 return;
77 } 73 }
78 74
79 fail: 75 fail:
80 Dart_ThrowException(exception); 76 Dart_ThrowException(exception);
81 ASSERT_NOT_REACHED(); 77 ASSERT_NOT_REACHED();
82 } 78 }
83 79
84 void pushStateCallback(Dart_NativeArguments args) 80 void pushStateCallback(Dart_NativeArguments args)
85 { 81 {
86 addStateObjectHelper(args, History::StateObjectPush); 82 addStateObjectHelper(args, History::StateObjectPush);
87 } 83 }
88 84
89 void replaceStateCallback(Dart_NativeArguments args) 85 void replaceStateCallback(Dart_NativeArguments args)
90 { 86 {
91 addStateObjectHelper(args, History::StateObjectReplace); 87 addStateObjectHelper(args, History::StateObjectReplace);
92 } 88 }
93 89
94 } 90 }
95 91
96 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698