webengine/osswebengine/WebCore/platform/symbian/OOMHandler.cpp
changeset 11 c8a366e56285
parent 5 10e98eab6f85
child 25 0ed94ceaa377
equal deleted inserted replaced
10:a359256acfc6 11:c8a366e56285
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (C) 2007 Nokia, Inc.  All rights reserved.
     3 * All rights reserved.
     3  *
     4 * This component and the accompanying materials are made available
     4  * Redistribution and use in source and binary forms, with or without
     5 * under the terms of the License "Eclipse Public License v1.0"
     5  * modification, are permitted provided that the following conditions
     6 * which accompanies this distribution, and is available
     6  * are met:
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  *
     8 *
     8  * 1.  Redistributions of source code must retain the above copyright
     9 * Initial Contributors:
     9  *     notice, this list of conditions and the following disclaimer. 
    10 * Nokia Corporation - initial contribution.
    10  * 2.  Redistributions in binary form must reproduce the above copyright
    11 *
    11  *     notice, this list of conditions and the following disclaimer in the
    12 * Contributors:
    12  *     documentation and/or other materials provided with the distribution. 
    13 *
    13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
    14 * Description:  
    14  *     its contributors may be used to endorse or promote products derived
    15 *
    15  *     from this software without specific prior written permission. 
    16 */
    16  *
       
    17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
       
    18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
    19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
       
    20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
       
    21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
       
    22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
       
    23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
       
    24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
       
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    27  */
    17 
    28 
    18 #include "config.h"
    29 #include "config.h"
    19 #include "OOMHandler.h"
    30 #include "OOMHandler.h"
    20 /*
    31 /*
    21  * Copyright (C) 2007 Nokia, Inc.  All rights reserved.
    32  * Copyright (C) 2007 Nokia, Inc.  All rights reserved.
    56 namespace WebCore {
    67 namespace WebCore {
    57 
    68 
    58 OOMHandler::OOMHandler()
    69 OOMHandler::OOMHandler()
    59 {
    70 {
    60     MemoryManager::AddCollector(this);
    71     MemoryManager::AddCollector(this);
    61     MemoryManager::AddStopper(this);
       
    62 }
    72 }
    63 
    73 
    64 OOMHandler::~OOMHandler()
    74 OOMHandler::~OOMHandler()
    65 {
    75 {
    66     MemoryManager::RemoveCollector(this);
    76     MemoryManager::RemoveCollector(this);
    67     MemoryManager::RemoveStopper(this);
       
    68 }
    77 }
    69 
    78 
    70 TUint OOMHandler::Collect(TUint aRequired)
    79 TUint OOMHandler::Collect(TUint aRequired)
    71 {
    80 {
    72     // clear all cached images.
    81     // clear all cached images.
    77 void OOMHandler::Restore()
    86 void OOMHandler::Restore()
    78 {
    87 {
    79     // tot fixme: do nothing so far.
    88     // tot fixme: do nothing so far.
    80 }
    89 }
    81 
    90 
    82 void OOMHandler::Stop()
       
    83 {
       
    84     // the first step is to stop all the active loadings
       
    85     const Vector<CBrCtl*>& ctrls = StaticObjectsContainer::instance()->activeBrowserControls();
       
    86     for (int i=0; i<ctrls.size(); ++i) {
       
    87         ctrls[i]->webView()->mainFrame()->stopLoading();
       
    88     }
       
    89 }
    91 }
    90 
       
    91 }