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

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

Issue 203123006: Ignore V8's message handler that is invoked while we're initializing a window (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 static void reportFatalErrorInMainThread(const char* location, const char* messa ge) 79 static void reportFatalErrorInMainThread(const char* location, const char* messa ge)
80 { 80 {
81 int memoryUsageMB = blink::Platform::current()->actualMemoryUsageMB(); 81 int memoryUsageMB = blink::Platform::current()->actualMemoryUsageMB();
82 printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, locatio n, memoryUsageMB); 82 printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, locatio n, memoryUsageMB);
83 CRASH(); 83 CRASH();
84 } 84 }
85 85
86 static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Hand le<v8::Value> data) 86 static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Hand le<v8::Value> data)
87 { 87 {
88 ASSERT(isMainThread());
89 // It's possible that messageHandlerInMainThread() is invoked while we're in itializing a window.
90 // In that half-baked situation, we don't have a valid context nor a valid w orld,
91 // so just return immediately.
92 if (DOMWrapperWorld::windowIsBeingInitialized())
93 return;
94
88 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 95 v8::Isolate* isolate = v8::Isolate::GetCurrent();
89 // If called during context initialization, there will be no entered window. 96 // If called during context initialization, there will be no entered window.
90 DOMWindow* enteredWindow = enteredDOMWindow(isolate); 97 DOMWindow* enteredWindow = enteredDOMWindow(isolate);
91 if (!enteredWindow || !enteredWindow->isCurrentlyDisplayedInFrame()) 98 if (!enteredWindow || !enteredWindow->isCurrentlyDisplayedInFrame())
92 return; 99 return;
93 100
94 String errorMessage = toCoreString(message->Get()); 101 String errorMessage = toCoreString(message->Get());
95 102
96 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); 103 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
97 RefPtr<ScriptCallStack> callStack; 104 RefPtr<ScriptCallStack> callStack;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 v8::V8::AddMessageListener(messageHandlerInWorker); 238 v8::V8::AddMessageListener(messageHandlerInWorker);
232 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 239 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
233 240
234 v8::ResourceConstraints resourceConstraints; 241 v8::ResourceConstraints resourceConstraints;
235 uint32_t here; 242 uint32_t here;
236 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 243 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
237 v8::SetResourceConstraints(isolate, &resourceConstraints); 244 v8::SetResourceConstraints(isolate, &resourceConstraints);
238 } 245 }
239 246
240 } // namespace WebCore 247 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698