Symbian3/SDK/Source/GUID-8F8E3814-7ED6-4218-BEEF-741AE0E9366F.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
equal deleted inserted replaced
7:51a74ef9ed63 8:ae94777fff8f
    10 <!DOCTYPE task
    10 <!DOCTYPE task
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
    12 <task id="GUID-8F8E3814-7ED6-4218-BEEF-741AE0E9366F" xml:lang="en"><title>Changing
    12 <task id="GUID-8F8E3814-7ED6-4218-BEEF-741AE0E9366F" xml:lang="en"><title>Changing
    13 the Priority</title><shortdesc>This section describes how an application (internal or third-party)
    13 the Priority</title><shortdesc>This section describes how an application (internal or third-party)
    14 can change its priority by using OOM Monitor APIs.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
    14 can change its priority by using OOM Monitor APIs.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
    15 <context id="GUID-FD9A15E9-6313-4BD3-A52A-7E3B71D39B37-GENID-1-8-1-10-1-1-8-1-5-1-6-1-4-1-3-1"><p>An application
    15 <context id="GUID-FD9A15E9-6313-4BD3-A52A-7E3B71D39B37-GENID-1-10-1-10-1-1-8-1-5-1-6-1-4-1-3-1"><p>An application
    16 which is processing a task in the background can change its priority at runtime
    16 which is processing a task in the background can change its priority at runtime
    17 to protect itself from being closed by the OOM Monitor. For example:</p><ul>
    17 to protect itself from being closed by the OOM Monitor. For example:</p><ul>
    18 <li><p>Music Player playing music in the background</p></li>
    18 <li><p>Music Player playing music in the background</p></li>
    19 <li><p>Download Manager downloading a file in the background</p></li>
    19 <li><p>Download Manager downloading a file in the background</p></li>
    20 </ul><p>If an application is processing a task for the user in the background,
    20 </ul><p>If an application is processing a task for the user in the background,
    21 the application is said to be <codeph>Busy</codeph> and the OOM Monitor must
    21 the application is said to be <codeph>Busy</codeph> and the OOM Monitor must
    22 not close a <codeph>Busy</codeph> application. An application can declare
    22 not close a <codeph>Busy</codeph> application. An application can declare
    23 itself to be <codeph>Busy</codeph> using <xref href="GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73.dita#GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73/GUID-420ECF8B-970A-381A-9035-DC1FCE8B566C"><apiname>ROomMonitorSession::SetOomPriority(EOomPriorityBusy)</apiname></xref> method.
    23 itself to be <codeph>Busy</codeph> using <xref href="GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73.dita#GUID-02D1911A-D2E5-3D28-9B05-75DA0A75DE73/GUID-420ECF8B-970A-381A-9035-DC1FCE8B566C"><apiname>ROomMonitorSession::SetOomPriority(EOomPriorityBusy)</apiname></xref> method.
    24 When the application finishes its background job and becomes idle, it should
    24 When the application finishes its background job and becomes idle, it should
    25 change its priority to <codeph>Normal</codeph>.</p></context>
    25 change its priority to <codeph>Normal</codeph>.</p></context>
    26 <steps id="GUID-01A482C7-3004-484D-9948-B0B892E913AF-GENID-1-8-1-10-1-1-8-1-5-1-6-1-4-1-3-2">
    26 <steps id="GUID-01A482C7-3004-484D-9948-B0B892E913AF-GENID-1-10-1-10-1-1-8-1-5-1-6-1-4-1-3-2">
    27 <step id="GUID-83631E4F-71D0-4FD2-8FD6-46689AAFA761-GENID-1-8-1-10-1-1-8-1-5-1-6-1-4-1-3-2-1"><cmd>Create an OOM Monitor
    27 <step id="GUID-83631E4F-71D0-4FD2-8FD6-46689AAFA761-GENID-1-10-1-10-1-1-8-1-5-1-6-1-4-1-3-2-1"><cmd>Create an OOM Monitor
    28 session</cmd>
    28 session</cmd>
    29 <info><codeblock xml:space="preserve">ROomMonitorSession ioomMonitorSession;
    29 <info><codeblock xml:space="preserve">ROomMonitorSession ioomMonitorSession;
    30 CleanUpClosePushL(ioomMonitorSession);
    30 CleanUpClosePushL(ioomMonitorSession);
    31 User::LeaveIfError(ioomMonitorSession.Connect());
    31 User::LeaveIfError(ioomMonitorSession.Connect());
    32 </codeblock></info>
    32 </codeblock></info>
    33 </step>
    33 </step>
    34 <step id="GUID-3033BB28-ACC5-440C-9BDB-D1BC36CD001C-GENID-1-8-1-10-1-1-8-1-5-1-6-1-4-1-3-2-2"><cmd>Set the priority
    34 <step id="GUID-3033BB28-ACC5-440C-9BDB-D1BC36CD001C-GENID-1-10-1-10-1-1-8-1-5-1-6-1-4-1-3-2-2"><cmd>Set the priority
    35 for the application to <codeph>Busy</codeph> before performing the background
    35 for the application to <codeph>Busy</codeph> before performing the background
    36 task</cmd>
    36 task</cmd>
    37 <info><codeblock xml:space="preserve">iOomMonitorSession.SetOomPriority(ROomMonitorSession::EOomPriorityBusy);
    37 <info><codeblock xml:space="preserve">iOomMonitorSession.SetOomPriority(ROomMonitorSession::EOomPriorityBusy);
    38 DoCriticalBackgroundProcessingL();
    38 DoCriticalBackgroundProcessingL();
    39 </codeblock></info>
    39 </codeblock></info>
    41 <step id="GUID-33674FB1-56E4-46C6-B267-107A42FA3B57"><cmd>Set the priority
    41 <step id="GUID-33674FB1-56E4-46C6-B267-107A42FA3B57"><cmd>Set the priority
    42 for the application to <codeph>Normal</codeph> after the task is completed.</cmd>
    42 for the application to <codeph>Normal</codeph> after the task is completed.</cmd>
    43 <info><codeblock xml:space="preserve">iOomMonitorSession.SetOomPriority(ROomMonitorSession::EOomPriorityNormal);
    43 <info><codeblock xml:space="preserve">iOomMonitorSession.SetOomPriority(ROomMonitorSession::EOomPriorityNormal);
    44 </codeblock></info>
    44 </codeblock></info>
    45 </step>
    45 </step>
    46 <step id="GUID-5B3E8176-528F-45E7-B1CE-57ADCFAB5C6C-GENID-1-8-1-10-1-1-8-1-5-1-6-1-4-1-3-2-4"><cmd>Close the session.</cmd>
    46 <step id="GUID-5B3E8176-528F-45E7-B1CE-57ADCFAB5C6C-GENID-1-10-1-10-1-1-8-1-5-1-6-1-4-1-3-2-4"><cmd>Close the session.</cmd>
    47 <info><codeblock xml:space="preserve">iOomMonitorSession.Close();
    47 <info><codeblock xml:space="preserve">iOomMonitorSession.Close();
    48 </codeblock></info>
    48 </codeblock></info>
    49 </step>
    49 </step>
    50 </steps>
    50 </steps>
    51 </taskbody><related-links>
    51 </taskbody><related-links>