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

Side by Side Diff: Source/bindings/v8/V8Initializer.cpp

Issue 40433002: Make wrapperTypeInfo static member const in bindings classes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 2 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
« no previous file with comments | « Source/bindings/v8/V8GCController.cpp ('k') | Source/bindings/v8/V8PerContextData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "core/platform/MemoryUsageSupport.h" 50 #include "core/platform/MemoryUsageSupport.h"
51 #include "wtf/RefPtr.h" 51 #include "wtf/RefPtr.h"
52 #include "wtf/text/WTFString.h" 52 #include "wtf/text/WTFString.h"
53 #include <v8-debug.h> 53 #include <v8-debug.h>
54 #include <v8-defaults.h> 54 #include <v8-defaults.h>
55 55
56 namespace WebCore { 56 namespace WebCore {
57 57
58 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data, v 8::Isolate* isolate) 58 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data, v 8::Isolate* isolate)
59 { 59 {
60 WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); 60 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
61 61
62 if (V8Window::wrapperTypeInfo.equals(type)) { 62 if (V8Window::wrapperTypeInfo.equals(type)) {
63 v8::Handle<v8::Object> windowWrapper = host->FindInstanceInPrototypeChai n(V8Window::GetTemplate(isolate, worldTypeInMainThread(isolate))); 63 v8::Handle<v8::Object> windowWrapper = host->FindInstanceInPrototypeChai n(V8Window::GetTemplate(isolate, worldTypeInMainThread(isolate)));
64 if (windowWrapper.IsEmpty()) 64 if (windowWrapper.IsEmpty())
65 return 0; 65 return 0;
66 return V8Window::toNative(windowWrapper)->frame(); 66 return V8Window::toNative(windowWrapper)->frame();
67 } 67 }
68 68
69 if (V8History::wrapperTypeInfo.equals(type)) 69 if (V8History::wrapperTypeInfo.equals(type))
70 return V8History::toNative(host)->frame(); 70 return V8History::toNative(host)->frame();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture, v8::Isolate::GetCurrent()); 104 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture, v8::Isolate::GetCurrent());
105 105
106 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); 106 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
107 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin g(); 107 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin g();
108 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to WebCoreString(resourceName.As<v8::String>()); 108 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to WebCoreString(resourceName.As<v8::String>());
109 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCr ossOrigin : NotSharableCrossOrigin; 109 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCr ossOrigin : NotSharableCrossOrigin;
110 110
111 RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, messag e->GetLineNumber(), message->GetStartColumn() + 1, DOMWrapperWorld::current()); 111 RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, messag e->GetLineNumber(), message->GetStartColumn() + 1, DOMWrapperWorld::current());
112 if (V8DOMWrapper::isDOMWrapper(data)) { 112 if (V8DOMWrapper::isDOMWrapper(data)) {
113 v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data); 113 v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data);
114 WrapperTypeInfo* type = toWrapperTypeInfo(obj); 114 const WrapperTypeInfo* type = toWrapperTypeInfo(obj);
115 if (V8DOMException::wrapperTypeInfo.isSubclass(type)) { 115 if (V8DOMException::wrapperTypeInfo.isSubclass(type)) {
116 DOMException* exception = V8DOMException::toNative(obj); 116 DOMException* exception = V8DOMException::toNative(obj);
117 if (exception && !exception->messageForConsole().isEmpty()) 117 if (exception && !exception->messageForConsole().isEmpty())
118 event->setUnsanitizedMessage("Uncaught " + exception->toStringFo rConsole()); 118 event->setUnsanitizedMessage("Uncaught " + exception->toStringFo rConsole());
119 } 119 }
120 } 120 }
121 121
122 // This method might be called while we're creating a new context. In this c ase, we 122 // This method might be called while we're creating a new context. In this c ase, we
123 // avoid storing the exception object, as we can't create a wrapper during c ontext creation. 123 // avoid storing the exception object, as we can't create a wrapper during c ontext creation.
124 // FIXME: Can we even get here during initialization now that we bail out wh en GetEntered returns an empty handle? 124 // FIXME: Can we even get here during initialization now that we bail out wh en GetEntered returns an empty handle?
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 v8::ResourceConstraints resourceConstraints; 220 v8::ResourceConstraints resourceConstraints;
221 v8::ConfigureResourceConstraintsForCurrentPlatform(&resourceConstraints); 221 v8::ConfigureResourceConstraintsForCurrentPlatform(&resourceConstraints);
222 uint32_t here; 222 uint32_t here;
223 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 223 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
224 v8::SetResourceConstraints(&resourceConstraints); 224 v8::SetResourceConstraints(&resourceConstraints);
225 225
226 V8PerIsolateData::ensureInitialized(isolate); 226 V8PerIsolateData::ensureInitialized(isolate);
227 } 227 }
228 228
229 } // namespace WebCore 229 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8GCController.cpp ('k') | Source/bindings/v8/V8PerContextData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698