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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp

Issue 2702273004: bindings: Simplifies WindowProxyManager and its relation to Frame. (Closed)
Patch Set: Created 3 years, 10 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 addHiddenValueToArray(isolate, object, newValue, arrayIndex); 973 addHiddenValueToArray(isolate, object, newValue, arrayIndex);
974 } 974 }
975 975
976 v8::Isolate* toIsolate(ExecutionContext* context) { 976 v8::Isolate* toIsolate(ExecutionContext* context) {
977 if (context && context->isDocument()) 977 if (context && context->isDocument())
978 return V8PerIsolateData::mainThreadIsolate(); 978 return V8PerIsolateData::mainThreadIsolate();
979 return v8::Isolate::GetCurrent(); 979 return v8::Isolate::GetCurrent();
980 } 980 }
981 981
982 v8::Isolate* toIsolate(LocalFrame* frame) { 982 v8::Isolate* toIsolate(LocalFrame* frame) {
983 ASSERT(frame); 983 DCHECK(frame);
984 return frame->script().isolate(); 984 return frame->getWindowProxyManager()->isolate();
985 } 985 }
986 986
987 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, 987 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value,
988 v8::Isolate* isolate) { 988 v8::Isolate* isolate) {
989 value.As<v8::Object>() 989 value.As<v8::Object>()
990 ->SetIntegrityLevel(isolate->GetCurrentContext(), 990 ->SetIntegrityLevel(isolate->GetCurrentContext(),
991 v8::IntegrityLevel::kFrozen) 991 v8::IntegrityLevel::kFrozen)
992 .ToChecked(); 992 .ToChecked();
993 return value; 993 return value;
994 } 994 }
995 995
996 v8::Local<v8::Value> fromJSONString(v8::Isolate* isolate, 996 v8::Local<v8::Value> fromJSONString(v8::Isolate* isolate,
997 const String& stringifiedJSON, 997 const String& stringifiedJSON,
998 ExceptionState& exceptionState) { 998 ExceptionState& exceptionState) {
999 v8::Local<v8::Value> parsed; 999 v8::Local<v8::Value> parsed;
1000 v8::TryCatch tryCatch(isolate); 1000 v8::TryCatch tryCatch(isolate);
1001 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), 1001 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)),
1002 parsed, tryCatch)) { 1002 parsed, tryCatch)) {
1003 if (tryCatch.HasCaught()) 1003 if (tryCatch.HasCaught())
1004 exceptionState.rethrowV8Exception(tryCatch.Exception()); 1004 exceptionState.rethrowV8Exception(tryCatch.Exception());
1005 } 1005 }
1006 1006
1007 return parsed; 1007 return parsed;
1008 } 1008 }
1009 1009
1010 } // namespace blink 1010 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698