| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 | 6 |
| 7 from code import Code | 7 from code import Code |
| 8 from model import PropertyType | 8 from model import PropertyType |
| 9 import cpp_util | 9 import cpp_util |
| 10 import schema_util | 10 import schema_util |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 # Hack: tabs and windows have circular references, so only generate hard | 44 # Hack: tabs and windows have circular references, so only generate hard |
| 45 # references for them (i.e. anything that can't be forward declared). In | 45 # references for them (i.e. anything that can't be forward declared). In |
| 46 # other cases, generate soft dependencies so that they can include | 46 # other cases, generate soft dependencies so that they can include |
| 47 # non-optional types from other namespaces. | 47 # non-optional types from other namespaces. |
| 48 include_soft = self._namespace.name not in ('tabs', 'windows') | 48 include_soft = self._namespace.name not in ('tabs', 'windows') |
| 49 | 49 |
| 50 (c.Append('#ifndef %s' % ifndef_name) | 50 (c.Append('#ifndef %s' % ifndef_name) |
| 51 .Append('#define %s' % ifndef_name) | 51 .Append('#define %s' % ifndef_name) |
| 52 .Append() | 52 .Append() |
| 53 .Append('#include <stdint.h>') |
| 54 .Append() |
| 53 .Append('#include <map>') | 55 .Append('#include <map>') |
| 54 .Append('#include <string>') | 56 .Append('#include <string>') |
| 55 .Append('#include <vector>') | 57 .Append('#include <vector>') |
| 56 .Append() | 58 .Append() |
| 57 .Append('#include "base/basictypes.h"') | |
| 58 .Append('#include "base/logging.h"') | 59 .Append('#include "base/logging.h"') |
| 59 .Append('#include "base/memory/linked_ptr.h"') | 60 .Append('#include "base/memory/linked_ptr.h"') |
| 60 .Append('#include "base/memory/scoped_ptr.h"') | 61 .Append('#include "base/memory/scoped_ptr.h"') |
| 61 .Append('#include "base/values.h"') | 62 .Append('#include "base/values.h"') |
| 62 .Cblock(self._type_helper.GenerateIncludes(include_soft=include_soft)) | 63 .Cblock(self._type_helper.GenerateIncludes(include_soft=include_soft)) |
| 63 .Append() | 64 .Append() |
| 64 ) | 65 ) |
| 65 | 66 |
| 66 # Hack: we're not generating soft includes for tabs and windows, so we need | 67 # Hack: we're not generating soft includes for tabs and windows, so we need |
| 67 # to generate forward declarations for them. | 68 # to generate forward declarations for them. |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 """Builds the parameter list for a function, given an array of parameters. | 394 """Builds the parameter list for a function, given an array of parameters. |
| 394 """ | 395 """ |
| 395 # |error| is populated with warnings and/or errors found during parsing. | 396 # |error| is populated with warnings and/or errors found during parsing. |
| 396 # |error| being set does not necessarily imply failure and may be | 397 # |error| being set does not necessarily imply failure and may be |
| 397 # recoverable. | 398 # recoverable. |
| 398 # For example, optional properties may have failed to parse, but the | 399 # For example, optional properties may have failed to parse, but the |
| 399 # parser was able to continue. | 400 # parser was able to continue. |
| 400 if self._generate_error_messages: | 401 if self._generate_error_messages: |
| 401 params += ('base::string16* error',) | 402 params += ('base::string16* error',) |
| 402 return ', '.join(str(p) for p in params) | 403 return ', '.join(str(p) for p in params) |
| OLD | NEW |