03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 18.5<br />

When the buffer is full, or when a function such as DrawPolyLine()(which requires largescale<br />

data transfer) is invoked, the client interface 'flushes' the buffer – that is, it requests the<br />

window server to execute all operations stored in the buffer. The window server reads the<br />

buffer using an interthread read, and then executes all the drawing commands stored in it.<br />

The buffer is reasonably large and its format has been optimized so that the above<br />

commands and more would easily fit inside one buffer.<br />

Note<br />

Symbian has had two opportunities to see what happens if you don't do this<br />

kind of client-side buffering. During early Symbian OS development, prior to<br />

implementing the window server buffer, graphics were very slow. During the<br />

Java implementation project, prior to implementing client-side buffering from<br />

Java programs to the AWT server, a similar thing happened. You can see<br />

the effects for yourself on the emulator by putting the window server client<br />

interface into 'auto-flush' mode, which empties the buffer after each<br />

command. Use Ctrl + Alt + Shift + F to turn on auto-flush, and Ctrl + Alt +<br />

Shift + G to turn it off again. The difference is noticeable – and bear in mind<br />

that your PC's clock is probably many times faster than that of a Symbian OS<br />

phone.<br />

Client-side buffering has some consequences in the API. First, the operations that are<br />

buffered cannot return a result. Second, you sometimes need to be able to force a buffer<br />

flush. With the window server, a Flush()function is available for this purpose. Flush() is<br />

called by UIKON's active scheduler prior to waiting for the next request, so there are<br />

relatively few circumstances in which you would need to call it yourself.<br />

Note<br />

The stream store also implements client-side buffering. A write stream uses<br />

a buffer that is flushed to the destination file only when it is full, or when you<br />

call RWriteStream::CommitL(). A read stream uses a buffer, which it<br />

prefills from the source file and which it uses until another buffer of source<br />

data is needed.<br />

18.2.2 High-level Transactions<br />

If the overheads of a transaction are high, then if possible you should specify the client API<br />

so that one transaction does a lot of work.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!