⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 160671 in webkit


Ignore:
Timestamp:
Dec 16, 2013, 4:06:20 PM (13 years ago)
Author:
Brent Fulgham
Message:

Source/JavaScriptCore: [Win] Remove dead code after conversion to VS2013
​https://bugs.webkit.org/show_bug.cgi?id=125795

Reviewed by Darin Adler.

  • API/tests/testapi.c: Remove local nan implementation

Source/WebCore: [Win] Remove dead code after converstion to VS2013
​https://bugs.webkit.org/show_bug.cgi?id=125795

Reviewed by Darin Adler.

  • WebCorePrefix.h: Remove VS2012 include kludge.
  • loader/FTPDirectoryParser.cpp: Remove gmtime workaround code.
  • page/DOMWindow.cpp: Remove older pointer-based open implementation.
  • page/DOMWindow.h: Ditto
  • platform/text/TextEncodingRegistry.cpp:

(WebCore::TextEncodingNameHash::equal): Remove optimization bug workaround

  • testing/Internals.cpp:

(WebCore::Internals::openDummyInspectorFrontend): Remove compiler workaround

Source/WebKit: [Win] Remove dead code after conversion to VS2013
​https://bugs.webkit.org/show_bug.cgi?id=125795

Reviewed by Darin Adler.

  • WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

Remove unused function exports.

Source/WTF: [Win] Remove dead code after conversion to VS2013
​https://bugs.webkit.org/show_bug.cgi?id=125795

Reviewed by Darin Adler.

  • wtf/Assertions.h: Include <inttypes.h> now that it exists.
  • wtf/Compiler.h: Update compiler checks for VS2013, and

enable support for NEVER_INLINE

  • wtf/HashFunctions.h:

(WTF::PtrHash::hash): Remove compiler workaround.

  • wtf/MathExtras.h: Remove C99 functions that are now supplied

by the MS runtime library.

  • wtf/Platform.h: Remove old MSVC support flags.
  • wtf/StdLibExtras.h: Remove old MSVC workaround code.
Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/tests/testapi.c

    r160494 r160671  
    4444#endif
    4545
    46 #if COMPILER(MSVC)
    47 
    48 #if _MSC_VER < 1800
    49 #include <wtf/MathExtras.h>
    50 
    51 static double nan(const char*)
    52 {
    53     return std::numeric_limits<double>::quiet_NaN();
    54 }
    55 
    56 using std::isinf;
    57 using std::isnan;
    58 #endif
    59 
    60 #endif
    61 
    6246#if JSC_OBJC_API_ENABLED
    6347void testObjectiveCAPI(void);
  • trunk/Source/JavaScriptCore/ChangeLog

    r160670 r160671  
     12013-12-16  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Win] Remove dead code after conversion to VS2013
     4        https://bugs.webkit.org/show_bug.cgi?id=125795
     5
     6        Reviewed by Darin Adler.
     7
     8        * API/tests/testapi.c: Remove local nan implementation
     9
    1102013-12-16  Oliver Hunt  <oliver@apple.com>
    211
  • trunk/Source/WTF/ChangeLog

    r160655 r160671  
     12013-12-16  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Win] Remove dead code after conversion to VS2013
     4        https://bugs.webkit.org/show_bug.cgi?id=125795
     5
     6        Reviewed by Darin Adler.
     7
     8        * wtf/Assertions.h: Include <inttypes.h> now that it exists.
     9        * wtf/Compiler.h: Update compiler checks for VS2013, and
     10        enable support for NEVER_INLINE
     11        * wtf/HashFunctions.h:
     12        (WTF::PtrHash::hash): Remove compiler workaround.
     13        * wtf/MathExtras.h: Remove C99 functions that are now supplied
     14        by the MS runtime library.
     15        * wtf/Platform.h: Remove old MSVC support flags.
     16        * wtf/StdLibExtras.h: Remove old MSVC workaround code.
     17
    1182013-12-16  Alex Christensen  <achristensen@webkit.org>
    219
  • trunk/Source/WTF/wtf/Assertions.h

    r160648 r160671  
    3737*/
    3838
    39 #include <wtf/Platform.h>
    40 
     39#include <inttypes.h>
    4140#include <stdarg.h>
    4241#include <stddef.h>
    43 
    44 #if !COMPILER(MSVC)
    45 #include <inttypes.h>
    46 #endif
     42#include <wtf/Platform.h>
    4743
    4844#ifdef NDEBUG
  • trunk/Source/WTF/wtf/Compiler.h

    r160648 r160671  
    6666
    6767/* COMPILER(MSVC) - Microsoft Visual C++ */
    68 /* COMPILER(MSVC9_OR_LOWER) - Microsoft Visual C++ 2008 or lower*/
    6968#if defined(_MSC_VER)
     69#if _MSC_VER < 1800
     70#error "Please use a newer version of Visual Studio. WebKit requires VS2013 or newere to compile."
     71#endif
    7072#define WTF_COMPILER_MSVC 1
    71 #if _MSC_VER < 1600
    72 #define WTF_COMPILER_MSVC9_OR_LOWER 1
    73 #endif
    7473
    7574/* Specific compiler features */
    76 #if !COMPILER(CLANG) && _MSC_VER >= 1600
     75#if !COMPILER(CLANG)
    7776#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
    7877#endif
    … …  
    8079#if !COMPILER(CLANG)
    8180#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
    82 #if !defined(_MSC_VER) || _MSC_VER < 1800
    83 #define WTF_COMPILER_QUIRK_FINAL_IS_CALLED_SEALED 1
    84 #endif
    85 #endif
    86 
    87 /* Check for VS2010 or newer */
    88 #if _MSC_VER >= 1600
     81#endif
     82
    8983#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 1
    9084#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1
    9185#define WTF_COMPILER_SUPPORTS_CXX_AUTO_TYPE 1
    92 #endif
    93 
    94 #if _MSC_VER >= 1700
    9586#define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS 1
    9687#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
    97 #endif
    98 
    99 #if _MSC_VER >= 1800
    10088#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1
    10189#define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1
    10290#define WTF_COMPILER_SUPPORTS_CXX_GENERALIZED_INITIALIZERS 1
    10391#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES 1
    104 #endif
    10592
    10693#endif /* defined(_MSC_VER) */
    … …  
    224211#if COMPILER(GCC)
    225212#define NEVER_INLINE __attribute__((__noinline__))
     213#elif COMPILER(MSVC) || COMPILER(RVCT)
     214#define NEVER_INLINE __declspec(noinline)
    226215#else
    227216#define NEVER_INLINE
    … …  
    350339#endif
    351340
    352 
    353 
    354341#endif /* WTF_Compiler_h */
  • trunk/Source/WTF/wtf/HashFunctions.h

    r157653 r160671  
    123123        static unsigned hash(T key)
    124124        {
    125 #if COMPILER(MSVC)
    126 #pragma warning(push)
    127 #pragma warning(disable: 4244) // work around what seems to be a bug in MSVC's conversion warnings
    128 #endif
    129125            return IntHash<uintptr_t>::hash(reinterpret_cast<uintptr_t>(key));
    130 #if COMPILER(MSVC)
    131 #pragma warning(pop)
    132 #endif
    133126        }
    134127        static bool equal(T a, T b) { return a == b; }
    … …  
    178171    template<> struct DefaultHash<unsigned long long> { typedef IntHash<unsigned long long> Hash; };
    179172
    180 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
     173#if defined(_NATIVE_WCHAR_T_DEFINED)
    181174    template<> struct DefaultHash<wchar_t> { typedef IntHash<wchar_t> Hash; };
    182175#endif
  • trunk/Source/WTF/wtf/MathExtras.h

    r160254 r160671  
    122122#endif
    123123
    124 #if COMPILER(MSVC)
    125 
    126 #if _MSC_VER < 1800
    127 // We must not do 'num + 0.5' or 'num - 0.5' because they can cause precision loss.
    128 static double round(double num)
    129 {
    130     double integer = ceil(num);
    131     if (num > 0)
    132         return integer - num > 0.5 ? integer - 1.0 : integer;
    133     return integer - num >= 0.5 ? integer - 1.0 : integer;
    134 }
    135 static float roundf(float num)
    136 {
    137     float integer = ceilf(num);
    138     if (num > 0)
    139         return integer - num > 0.5f ? integer - 1.0f : integer;
    140     return integer - num >= 0.5f ? integer - 1.0f : integer;
    141 }
    142 
    143 inline long long llround(double num) { return static_cast<long long>(round(num)); }
    144 inline long long llroundf(float num) { return static_cast<long long>(roundf(num)); }
    145 inline long lround(double num) { return static_cast<long>(round(num)); }
    146 inline long lroundf(float num) { return static_cast<long>(roundf(num)); }
    147 inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
    148 
    149 inline double remainder(double numerator, double denominator)
    150 {
    151     double result = fmod(numerator, denominator);
    152     if (result > 0.5 * denominator)
    153         return result - denominator;
    154 
    155     return result;
    156 }
    157 
    158 inline double asinh(double d)
    159 {
    160     return log(d + sqrt(d * d + 1.0));
    161 }
    162 
    163 inline double acosh(double d)
    164 {
    165     return log(d + sqrt(d + 1) * sqrt(d - 1));
    166 }
    167 
    168 inline double atanh(double d)
    169 {
    170     return (log((1.0 + d) / (1.0 - d))) / 2.0;
    171 }
    172 
    173 inline double expm1(double d)
    174 {
    175     return exp(d) - 1.0;
    176 }
    177 
    178 inline double log1p(double d)
    179 {
    180     return log(1.0 + d);
    181 }
    182 
    183 inline double cbrt(double d)
    184 {
    185     return pow(d, 1.0 / 3.0);
    186 }
    187 
    188 #endif
    189 
    190 #endif
    191 
    192124#if COMPILER(GCC) && OS(QNX)
    193125// The stdlib on QNX doesn't contain long abs(long). See PR #104666.
    … …  
    196128
    197129#if COMPILER(MSVC)
    198 // MSVC's math.h does not currently supply log2 or log2f.
    199 inline double log2(double num)
    200 {
    201     // This constant is roughly M_LN2, which is not provided by default on Windows.
    202     return log(num) / 0.693147180559945309417232121458176568;
    203 }
    204 
    205 inline float log2f(float num)
    206 {
    207     // This constant is roughly M_LN2, which is not provided by default on Windows.
    208     return logf(num) / 0.693147180559945309417232121458176568f;
    209 }
    210 #endif
    211 
    212 #if COMPILER(MSVC)
    213 // The 64bit version of abs() is already defined in stdlib.h which comes with VC10
    214 #if COMPILER(MSVC9_OR_LOWER)
    215 inline long long abs(long long num) { return _abs64(num); }
    216 #endif
    217 
    218 #if _MSC_VER < 1800
    219 
    220 namespace std {
    221 
    222 inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
    223 inline bool isnan(double num) { return !!_isnan(num); }
    224 inline bool isfinite(double x) { return _finite(x); }
    225 inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
    226 
    227 } // namespace std
    228 
    229 #endif
    230 
    231 inline double nextafter(double x, double y) { return _nextafter(x, y); }
    232 inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; }
    233 
    234 inline double copysign(double x, double y) { return _copysign(x, y); }
    235130
    236131// Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values.
  • trunk/Source/WTF/wtf/Platform.h

    r160648 r160671  
    936936   to WTF causes many ports to break, and so this way we can address the build
    937937   breakages one port at a time. */
    938 #if !defined(WTF_USE_EXPORT_MACROS) && (PLATFORM(MAC) || (PLATFORM(WIN) && (defined(_MSC_VER) && _MSC_VER >= 1600)))
     938#if !defined(WTF_USE_EXPORT_MACROS) && (PLATFORM(MAC) || PLATFORM(WIN))
    939939#define WTF_USE_EXPORT_MACROS 1
    940940#endif
  • trunk/Source/WTF/wtf/StdLibExtras.h

    r160561 r160671  
    311311}
    312312
    313 #if (defined(_MSC_VER) && _MSC_VER < 1700) || (COMPILER(GCC) && !COMPILER(CLANG) && !GCC_VERSION_AT_LEAST(4, 8, 1))
     313#if (COMPILER(GCC) && !COMPILER(CLANG) && !GCC_VERSION_AT_LEAST(4, 8, 1))
    314314
    315315// Work-around for Pre-C++11 syntax in MSVC 2010, and prior as well as GCC < 4.8.1.
  • trunk/Source/WebCore/ChangeLog

    r160669 r160671  
     12013-12-16  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Win] Remove dead code after converstion to VS2013
     4        https://bugs.webkit.org/show_bug.cgi?id=125795
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebCorePrefix.h: Remove VS2012 include kludge.
     9        * loader/FTPDirectoryParser.cpp: Remove gmtime workaround code.
     10        * page/DOMWindow.cpp: Remove older pointer-based open implementation.
     11        * page/DOMWindow.h: Ditto
     12        * platform/text/TextEncodingRegistry.cpp:
     13        (WebCore::TextEncodingNameHash::equal): Remove optimization bug workaround
     14        * testing/Internals.cpp:
     15        (WebCore::Internals::openDummyInspectorFrontend): Remove compiler workaround
     16
    1172013-12-16  Daniel Bates  <dabates@apple.com>
    218
  • trunk/Source/WebCore/WebCorePrefix.h

    r156302 r160671  
    131131#if USE(CG)
    132132
    133 #if defined(_MSC_VER) && _MSC_VER <= 1600
    134 
    135 #include <WebCore/WebCoreHeaderDetection.h>
    136 
    137 #if HAVE(AVCF_LEGIBLE_OUTPUT)
    138 // These must be defined before including CGFloat.h
    139 // This can be removed once we move to VS2012 or newer
    140 #include <wtf/ExportMacros.h>
    141 #include <wtf/MathExtras.h>
    142 
    143 #define isnan _isnan
    144 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
    145 #include <CoreGraphics/CGFloat.h>
    146 #endif
    147 #include <CoreGraphics/CoreGraphics.h>
    148 #undef isnan
    149 #endif
    150 #endif
    151 
    152133// FIXME <rdar://problem/8208868> Remove support for obsolete ColorSync API, CoreServices header in CoreGraphics
    153134// We can remove this once the new ColorSync APIs are available in an internal Safari SDK.
  • trunk/Source/WebCore/loader/FTPDirectoryParser.cpp

    r160581 r160671  
    11/*
    22 * Copyright (C) 2002 Cyrus Patel <cyp@fb14.uni-mainz.de>
    3  *           (C) 2007 Apple Inc. All rights reserved.
     3 *           (C) 2007, 2013 Apple Inc. All rights reserved.
    44 *
    55 * This library is free software; you can redistribute it and/or
    … …  
    3737namespace WebCore {
    3838#if OS(WINDOWS) && !defined(gmtime_r)
    39 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
    4039#define gmtime_r(x, y) gmtime_s((y), (x))
    41 #else /* !_MSC_VER */
    42 #define gmtime_r(x,y) (gmtime(x)?(*(y)=*gmtime(x),(y)):0)
    43 #endif
    4440#endif
    4541
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r157971 r160671  
    19011901}
    19021902
    1903 #if defined(_MSC_VER) && _MSC_VER <= 1700
    1904 // Work around a compiler bug in Visual Studio:
    1905 PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
    1906     DOMWindow* activeWindow, DOMWindow* firstWindow)
    1907 {
    1908     return open(urlString, frameName, windowFeaturesString, *activeWindow, *firstWindow);
    1909 }
    1910 #endif
    1911 
    19121903PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
    19131904    DOMWindow& activeWindow, DOMWindow& firstWindow)
  • trunk/Source/WebCore/page/DOMWindow.h

    r159284 r160671  
    161161        PassRefPtr<DOMWindow> open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
    162162            DOMWindow& activeWindow, DOMWindow& firstWindow);
    163 #if defined(_MSC_VER) && _MSC_VER <= 1700
    164         PassRefPtr<DOMWindow> open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
    165             DOMWindow* activeWindow, DOMWindow* firstWindow);
    166 #endif
    167163
    168164        typedef void (*PrepareDialogFunction)(DOMWindow*, void* context);
  • trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp

    r152456 r160671  
    6666        char c2;
    6767        do {
    68 #if defined(_MSC_VER) && _MSC_VER == 1700
    69             // Workaround for a bug in the VS2012 Update1 and Update2 optimizer, remove once the fix is released.
    70             // https://connect.microsoft.com/VisualStudio/feedback/details/781189/vs2012-update-ctp4-c-optimizing-bug
    71             c1 = toASCIILower(*s1++);
    72             c2 = toASCIILower(*s2++);
    73             if (c1 != c2)
    74                 return false;
    75 #else
    7668            c1 = *s1++;
    7769            c2 = *s2++;
    7870            if (toASCIILower(c1) != toASCIILower(c2))
    7971                return false;
    80 #endif
    8172        } while (c1 && c2);
    8273        return !c1 && !c2;
  • trunk/Source/WebCore/testing/Internals.cpp

    r160457 r160671  
    15381538    ASSERT(window);
    15391539
    1540 #if defined(_MSC_VER) && _MSC_VER <= 1700
    1541     m_frontendWindow = window->open(url, "", "", window, window); // Work around bug in VS2010 and earlier
    1542 #else
    15431540    m_frontendWindow = window->open(url, "", "", *window, *window);
    1544 #endif
    15451541    ASSERT(m_frontendWindow);
    15461542
  • trunk/Source/WebKit/ChangeLog

    r160655 r160671  
     12013-12-16  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Win] Remove dead code after conversion to VS2013
     4        https://bugs.webkit.org/show_bug.cgi?id=125795
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
     9        Remove unused function exports.
     10
    1112013-12-16  Alex Christensen  <achristensen@webkit.org>
    212
  • trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in

    r160463 r160671  
    348348        symbolWithPointer(?close@DOMWindow@WebCore@@QAEXPAVScriptExecutionContext@2@@Z, ?close@DOMWindow@WebCore@@QEAAXPEAVScriptExecutionContext@2@@Z)
    349349        symbolWithPointer(?document@DOMWindow@WebCore@@QBEPAVDocument@2@XZ, ?document@DOMWindow@WebCore@@QEBAPEAVDocument@2@XZ)
    350 #if _MSC_VER < 1800
    351         symbolWithPointer(?open@DOMWindow@WebCore@@QAE?AV?$PassRefPtr@VDOMWindow@WebCore@@@WTF@@ABVString@4@ABVAtomicString@4@0PAV12@2@Z, ?open@DOMWindow@WebCore@@QEAA?AV?$PassRefPtr@VDOMWindow@WebCore@@@WTF@@AEBVString@4@AEBVAtomicString@4@0PEAV12@2@Z)
    352 #else
    353350        symbolWithPointer(?open@DOMWindow@WebCore@@QAE?AV?$PassRefPtr@VDOMWindow@WebCore@@@WTF@@ABVString@4@ABVAtomicString@4@0AAV12@2@Z, ?open@DOMWindow@WebCore@@QEAA?AV?$PassRefPtr@VDOMWindow@WebCore@@@WTF@@AEBVString@4@AEBVAtomicString@4@0AEAV12@2@Z)
    354 
    355 #endif
    356351        symbolWithPointer(?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVDOMWindow@1@@Z, ?toJS@WebCore@@YA?AVJSValue@JSC@@PEAVExecState@3@PEAVJSDOMGlobalObject@1@PEAVDOMWindow@1@@Z)
    357352        symbolWithPointer(?layerTreeAsText@Frame@WebCore@@QBE?AVString@WTF@@I@Z, ?layerTreeAsText@Frame@WebCore@@QEBA?AVString@WTF@@I@Z)
    … …  
    443438        symbolWithPointer(?toUInt32EnforceRange@WebCore@@YAIPAVExecState@JSC@@VJSValue@3@@Z, ?toUInt32EnforceRange@WebCore@@YAIPEAVExecState@JSC@@VJSValue@3@@Z)
    444439        symbolWithPointer(?toUInt64@WebCore@@YA_KPAVExecState@JSC@@VJSValue@3@W4IntegerConversionConfiguration@1@@Z, ?toUInt64@WebCore@@YA_KPEAVExecState@JSC@@VJSValue@3@W4IntegerConversionConfiguration@1@@Z)
    445         symbolWithPointer(?commonVM@JSDOMWindowBase@WebCore@@SAPAVVM@JSC@@XZ, ?commonVM@JSDOMWindowBase@WebCore@@SAPEAVVM@JSC@@XZ)
    446 
     440\
    447441#if ENABLE(VIDEO)
    448442        symbolWithPointer(?toTimeRanges@WebCore@@YAPAVTimeRanges@1@VJSValue@JSC@@@Z, ?toTimeRanges@WebCore@@YAPEAVTimeRanges@1@VJSValue@JSC@@@Z)
    … …  
    464458        symbolWithPointer(?setDefaultOriginQuota@ApplicationCacheStorage@WebCore@@QAEX_J@Z, ?setDefaultOriginQuota@ApplicationCacheStorage@WebCore@@QEAAX_J@Z)
    465459        symbolWithPointer(?vm@ScriptExecutionContext@WebCore@@QAEPAVVM@JSC@@XZ, ?vm@ScriptExecutionContext@WebCore@@QEAAPEAVVM@JSC@@XZ)
    466 #if _MSC_VER >= 1800
    467460        symbolWithPointer(?completeURL@Document@WebCore@@UBE?AVURL@2@ABVString@WTF@@@Z, ?completeURL@Document@WebCore@@UBEA?AVURL@2@AEBVString@WTF@@@Z)
    468461        symbolWithPointer(??1DOMWindow@WebCore@@UAE@XZ, ??1DOMWindow@WebCore@@UEAA@XZ)
    469462        symbolWithPointer(?visibleContentRect@ScrollView@WebCore@@UBE?AVIntRect@2@W4VisibleContentRectIncludesScrollbars@ScrollableArea@2@@Z, ?visibleContentRect@ScrollView@WebCore@@UEAA?AVIntRect@2@W4VisibleContentRectIncludesScrollbars@ScrollableArea@2@@Z)
    470 #endif
Note: See TracChangeset for help on using the changeset viewer.