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

Side by Side Diff: Source/bindings/core/v8/V8Binding.h

Issue 232563003: API functions returning Promises should not throw exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 943
944 private: 944 private:
945 v8::HandleScope m_handleScope; 945 v8::HandleScope m_handleScope;
946 v8::Context::Scope m_contextScope; 946 v8::Context::Scope m_contextScope;
947 RefPtr<ScriptState> m_scriptState; 947 RefPtr<ScriptState> m_scriptState;
948 }; 948 };
949 949
950 void GetDevToolsFunctionInfo(v8::Handle<v8::Function>, v8::Isolate*, int& script Id, String& resourceName, int& lineNumber); 950 void GetDevToolsFunctionInfo(v8::Handle<v8::Function>, v8::Isolate*, int& script Id, String& resourceName, int& lineNumber);
951 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext*, v8::Handle<v8::Function>, v8::Isolate*); 951 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext*, v8::Handle<v8::Function>, v8::Isolate*);
952 952
953 class V8RethrowTryCatchScope FINAL { 953 class V8RethrowTryCatchScope FINAL {
haraken 2014/07/31 07:54:47 Just to confirm: Do you have a plan to remove V8Re
Jens Widell 2014/07/31 08:29:09 V8RethrowTryCatchScope isn't a workaround for the
haraken 2014/07/31 08:40:29 Understood. Then it makes sense to have a cancel()
954 public: 954 public:
955 explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block) { } 955 explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block), m_isC anceled(false) { }
haraken 2014/07/31 07:54:47 Drop explicit.
yhirano 2014/08/01 02:27:57 It should be explicit, shouldn't it?
haraken 2014/08/01 02:42:40 Sorry, I misread the code.
956 void cancel() { m_isCanceled = true; }
956 ~V8RethrowTryCatchScope() 957 ~V8RethrowTryCatchScope()
957 { 958 {
958 // ReThrow() is a no-op if no exception has been caught, so always call. 959 if (!m_isCanceled) {
959 m_block.ReThrow(); 960 // ReThrow() is a no-op if no exception has been caught, so always
961 // call.
962 m_block.ReThrow();
963 }
960 } 964 }
961 965
962 private: 966 private:
963 v8::TryCatch& m_block; 967 v8::TryCatch& m_block;
964 }; 968 bool m_isCanceled;
965
966 class V8ResetTryCatchScope FINAL {
967 public:
968 explicit V8ResetTryCatchScope(v8::TryCatch& block) : m_block(block) { }
969 ~V8ResetTryCatchScope()
970 {
971 m_block.Reset();
972 }
973
974 private:
975 v8::TryCatch& m_block;
976 }; 969 };
977 970
978 } // namespace blink 971 } // namespace blink
979 972
980 #endif // V8Binding_h 973 #endif // V8Binding_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698