DatabaseBackend should not post a task to an already terminated database thread

Currently some methods of DatabaseBackend post a task to a database thread without checking DatabaseThread::terminationRequested(). Consequently, the task can be posted to an already terminated database thread.

This is problematic but by accident isn't currently causing any real issue (for some reason). This begins to cause an issue when I destruct DatabaseThread::m_thread promptly after the database thread processed a cleanup task (See https://codereview.chromium.org/589363002).

This CL adds the necessary DatabaseThread::terminationRequested()s before DatabaseBackend posts a task to the database thread.

BUG=340522

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=182552

Review URL: https://codereview.chromium.org/596083005

git-svn-id: svn://svn.chromium.org/blink/trunk@182593 bbb929c8-8fbe-4397-9dbb-9b2b20218538