1 /* 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006 David Smith (catfish.man (at) gmail.com) 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 15 * its contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #import "WebViewData.h" 31 32 #import "WebKitLogging.h" 33 #import "WebPreferenceKeysPrivate.h" 34 #import <WebCore/WebCoreObjCExtras.h> 35 #import <WebCore/HistoryItem.h> 36 #import <objc/objc-auto.h> 37 #import <runtime/InitializeThreading.h> 38 #import <wtf/Threading.h> 39 40 BOOL applicationIsTerminating = NO; 41 int pluginDatabaseClientCount = 0; 42 43 @implementation WebViewPrivate 44 45 + (void)initialize 46 { 47 JSC::initializeThreading(); 48 WTF::initializeMainThreadToProcessMainThread(); 49 #ifndef BUILDING_ON_TIGER 50 WebCoreObjCFinalizeOnMainThread(self); 51 #endif 52 } 53 54 - (id)init 55 { 56 self = [super init]; 57 if (!self) 58 return nil; 59 60 allowsUndo = YES; 61 usesPageCache = YES; 62 shouldUpdateWhileOffscreen = YES; 63 cssAnimationsSuspended = NO; 64 65 zoomMultiplier = 1; 66 zoomsTextOnly = NO; 67 68 interactiveFormValidationEnabled = NO; 69 // The default value should be synchronized with WebCore/page/Settings.cpp. 70 validationMessageTimerMagnification = 50; 71 72 #if ENABLE(DASHBOARD_SUPPORT) 73 dashboardBehaviorAllowWheelScrolling = YES; 74 #endif 75 76 #if !defined(BUILDING_ON_TIGER) 77 shouldCloseWithWindow = objc_collectingEnabled(); 78 #else 79 shouldCloseWithWindow = NO; 80 #endif 81 82 smartInsertDeleteEnabled = ![[NSUserDefaults standardUserDefaults] objectForKey:WebSmartInsertDeleteEnabled] 83 || [[NSUserDefaults standardUserDefaults] boolForKey:WebSmartInsertDeleteEnabled]; 84 85 86 pluginDatabaseClientCount++; 87 88 return self; 89 } 90 91 - (void)dealloc 92 { 93 ASSERT(applicationIsTerminating || !page); 94 ASSERT(applicationIsTerminating || !preferences); 95 ASSERT(!insertionPasteboard); 96 #if ENABLE(VIDEO) 97 ASSERT(!fullscreenController); 98 #endif 99 100 [applicationNameForUserAgent release]; 101 [backgroundColor release]; 102 [inspector release]; 103 [currentNodeHighlight release]; 104 [hostWindow release]; 105 [policyDelegateForwarder release]; 106 [UIDelegateForwarder release]; 107 [frameLoadDelegateForwarder release]; 108 [editingDelegateForwarder release]; 109 [mediaStyle release]; 110 111 [super dealloc]; 112 } 113 114 - (void)finalize 115 { 116 ASSERT_MAIN_THREAD(); 117 ASSERT(!insertionPasteboard); 118 #if ENABLE(VIDEO) 119 ASSERT(!fullscreenController); 120 #endif 121 122 [super finalize]; 123 } 124 125 @end 126